R0J0hound's Forum Posts

  • Found a program here:

    http://www.thesimplest.net/pc/simplest-way-print-screen-screen-capture-window-needs-scrolling

    That takes a screenshot of a scrolling window. I tested it and it works well with event sheets.

  • The OnYes condition is a triggered event, which is only triggered in the event sheet and not in python. You'll have to either use just events or do it the way you'd have to do it without Construct in pure python by using a python library.

  • Well you don't have to use the snapshot, it can also load images in the files folder.

    So as in the title "why not", I updated this further. It now converts an image directly that can be loaded into the tilemap object. Right now it just does tile/no tile based on the alpha of the pixels, but it can be tweaked to use different tiles based on color.

    https://www.dropbox.com/s/vsq1xdlyvr7od ... .capx?dl=0

    Also on the plus side it's much faster. For me it works in just under a second for a 1280x1024 image.

  • JJList

    This reply is a bit late but as for the original clearing I couldn't get it any faster by not using sqrt.

    As for using the pixels from the canvas object here's an example:

    https://dl.dropboxusercontent.com/u/5426011/examples21/canvasWithTileMap.capx

    It is very slow, for me the whole bit takes about 5 seconds to transfer the canvas to the tilemap.

    So on a whim I also did a test with a snapshot and straight javascript using the browser object since I didn't want to make a plugin.

    https://dl.dropboxusercontent.com/u/5426011/examples21/snapshot2tilemap.capx

    For me it takes about 3 seconds. After looking at the times I think it can be made faster by bypassing the array and just converting the pixels to a format the tilemap can load. But that isn't a simple task as the format is pretty complicated.

  • Your slider setup had to be tweaked to make it possible.

    https://dl.dropboxusercontent.com/u/5426011/examples21/3slider.capx

    The "balance" function is what adjusts the non-picked sliders.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It appears to be some kind of rounding issue. If you increase the 10 to 100 then it works.

    Ok, now I get it. The rgb() function converts the parameters to integers by basically running floor() on each. With a starting red of 150 then subtracting from that gives a number a bit less than 150 which rounds with floor to 149. But with adding you get a number a bit bigger than 150 which rounds with "floor" to 150. So the red will only increase if you add 1 or more to it at a time.

    A solution is to have a global or private variable to increase/decrease and set the red from that.

  • I'm impressed that the tilemap renders so fast with 1x1 tiles. This has potential, and I do enjoy optimizing.

    I took your forth capx and added a text object to store the average time it takes the function to clear a circle.

    https://www.dropbox.com/s/mwjxctu4vhx7w ... .capx?dl=0

    So now I have something to compare against. For an initial test I went for circle clearing with as few events as possible. The algorithm I used is just the graph of a circle. Bresenham's algorithm probably will be faster but I haven't fiddled with your events with the same stuff I did with mine.

    https://www.dropbox.com/s/t8mizv3e6hugt ... .capx?dl=0

    Compared to the two "simple.capx" is about 3 times faster. Here are some things I did and my reasoning. Note that I wasn't profiling as I went along so I'm unsure of the boost each gave, if any.

    * I changed the function so x,y and radius are passed as parameters. This to eliminate the need to re-pick the bullet in the function. Actually this probably was a negligible change. It was more of a style preference.

    * I used "erase tile range" instead of "erase tile". This likely was the biggest boost since it eliminated a loop level since we can just erase spans of tiles at a time.

    * I didn't use the "Tilemap.PositionToTile" functions since with 1x1 tiles pixel position is the same as tile position. A little flexibility is lost doing this since the tilemap object has to be at position 0,0.

    That's about it. Next I'll have tinker with your events to see avoiding a sqrt() with some more events perform better.

  • delgado

    Just drag the c2addon file into C2's window and it should install.

  • AnD4D

    ARM and x86 are the processor types. ARM is what almost all android devices use so I'd say pick that.

  • "-Have save games/ chapters that user can load"

    Yes, look at the webstorage object

    "-Have moving objects in background (like people far away) that are walking?"

    Yes, anything you place in the editor is moveable at runtime.

    "-My final question is can I release it on Steam? "

    You can export it to an exe with the node-webkit export.

    https://www.scirra.com/manual/168/supported-platforms

  • For particle fluids using a bunch of circles with the physics behavior like it the video is probably the easiest way. However the physics behavior uses it's own collision detection so it isn't affected by the collision update.

    A more realistic motion of water would just be water particles that repel each other with forces instead of collision impulses. With that particles would only need to repel other particles close by, in which case the collision update might help a bit.

  • The color filter by default is white so adding to white will just clamp to white and do nothing. If you initially set the color filter to blue then adding will have an effect.

  • Hmm, even I had a bit of trouble finding the C2 example I made of 2d minecraft-like water. Here it is:

    http://www.scirra.com/forum/what-is-the-attributes-counterpart-in-construct-2_topic79372_post470236.html#470236

    Not the easiest to follow but basically all the water motion is done by checking the contents of grid positions around each water square.

    I started with something simple like this:

    If space below water is empty

    then add a new water below.

    To further extend it if a wall is below the water then new water is added to the left and right if the spaces are empty. Next to make areas fill up with water I treated water the same as a wall if the water had a wall to it's left, right and bottom. The water shares this info to water left and right. The final step I did was to have the water drain if walls were removed. It isn't 100% perfect but it's good enough.

    EDIT:

    Hey the capx in the topic was even in reply to RookieDev.

    Is terraria water that different? I've never played it.

  • That's solvable completely without the canvas plugin. Search for "laser" and you should find a few examples of making a laser that stops when hitting another object.

    Here's one:

    http://www.scirra.com/forum/laser-collision-point_topic44892.html, there are others.

  • On a side not C2's runtime will only redraw the screen if something visually changes. So you can carefully setup your events so things only change every 1/30 seconds. Of course as jayderyu mentioned it wouldn't really work with behaviors.

    EDIT:

    To add on to Arima's method you can use events like this:

    Every 1/30 seconds

    • make all layers visible

    Else

    • make all layers invisible