The Daily Click ::. Forums ::. Klik Coding Help ::. Chain reaction bomb drops
 

Post Reply  Post Oekaki 
 

Posted By Message

JetpackLover



Registered
  01/03/2007
Points
  212
24th January, 2011 at 10:06:40 -

I'm trying to get bombs to drop in a chain reaction. But since they are all the same object I know I can only interact with them by using spread values or using the object focus carefully.

I want it so if you touch one of the bombs it will drop from the ceiling and when it hits the ground the next one will drop.

The way it is now is you can touch one of the bombs and it will drop and hit the ground but I know if I try and use code that says "bomb collides with ground>start movement of bombs" that will drop them all at the same time. I want them to fall one by one.

Anyone got any ideas? I think I could use some kind of timer as well but that still leads to the problem of them all falling at once.

Sorry if my explanation sucks I'll explain it better if the need arises.

 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover


Mårten



Registered
  25/06/2002
Points
  769
1st February, 2011 at 13:49:27 -

Add another counter

As a bomb collides with the ground -> add 1 to the counter
If alt. value of a bomb is equal to the counter -> start movement of bomb (only once while condition is true)

Then it's just a matter of spreading the alt. value in the order you want them to fall.
If their positions are consistent I'd use a loop and place them at the start of the frame while simultaneously pushing the alt val in, like so:
Start of frame -> start loop "PLACE" [number of bombs] times
On loop "PLACE" -> Create bomb object
-> Set X/Y pos of bomb to (first bomb X/Y + loop index of "PLACE" * spacing)
-> set alt. value of bomb to loop index of "PLACE"

Edited by Mårten

 
---
   

Post Reply



 



Advertisement

Worth A Click