I am wondering of the method on how to create an expanding 'virus' in Construct 2. Have a look at this picture,
<img src="http://i50.tinypic.com/5po943.png" border="0" />
The virus is expanding at a rate of 1 block per second. Ideally the method would be memory efficient.
The virus also has to go around solid objects. How do I do this with Construct 2? I am not the best with this tool, so any guidance or help or hints would be lustrously indebted! This seems easy to make however it is a bit challenging when you sit down and try to do it.
Thanks and have an amazing day! <img src="smileys/smiley1.gif" border="0" align="middle" />
Develop games in your browser. Powerful, performant & highly capable.
I recommend using a grid system/array. Off the top of my head, I think the simplest way would be set a loop to pick a random grid (array) coordinate, check if it is next to an existing square, check to see if it is empty, then place the new block (empty=0, filled=1). If it fails the checks it will loop back to check a new random square.
Of course this isn't the most efficient method, and it might or might not get laggy depending on how big your grid is. Have the event fire off every second (all the looping and random picking happens effectively instantaneously).
Aleternativly by adding a few steps, you can pick a random array element that was previously filled (compare at x,y > 0), and check from there to see if any adjacent element is available (=0).
One way to do it is with overlapping at offset with collision poly that are a bit smaller than the image, so sprite next to each other aren't counted as overlapping.
Pathfinding sprites that leave behind a static (non-moving) instance of the block whenever they overalap a new tile on the grid?