How to know if all physics bodies are stopped.
scrapee_net
Member Posts: 424
iHello. Im developing my first game using gamesalad. But now I arrived to a situation that I cannot find solution.
Lets explain how my project works.
I have a timer that spawns a few actors on the scene, and these actors have an accelerate behavior, so they drop. I created a game attribute where is registered the total of actors added, so I can know when it is the last actor in that scene...
I also have a boolean game attribute called lastactor. When the last actor is added to the scene it is changed to true.
Here cames me trick.
What can I do to know if all the actors aren stopped?
thanks.
Lets explain how my project works.
I have a timer that spawns a few actors on the scene, and these actors have an accelerate behavior, so they drop. I created a game attribute where is registered the total of actors added, so I can know when it is the last actor in that scene...
I also have a boolean game attribute called lastactor. When the last actor is added to the scene it is changed to true.
Here cames me trick.
What can I do to know if all the actors aren stopped?
thanks.
Comments
If you are getting frustrated, make a copy of your project, take a step back for an hour or two, work on something else and then come back with a clear head and start playing around with the copy. Just mess around with settings - if anything it is a good way to familiarize yourself with the behaviours.
Good luck!
I have a scene atribute called, totalactors set to 10.
A have a rule where, while totalactors != 0, every 2 seconds spawns an actor, and when the actor is created, it change totalactors to totalactors-1. So when totalactors reachs 0, it stop adding more actors.
These actors are added to the top of the scene and they drop. So the user need to drag and stack them.
I need to find a way, to check the following:
if totalactors == 0,
then check if all cubes are stopped, not falling... It so, then set a timer to 4 seconds, and after these 4 seconds, if none of the cubes are moveing, then "Success".
I couldnt find a way, to if some of the cubes where moved before the 4 seconds, to reset the timer and start counting again.
To know if some cube is moving I creted this rules:
if(totalactors==0)}
if(actor collid or overlaps with other actors or the ground)}
// maybe here should came some function to start the timer, I really dont know.
}otherwise{
display text "moving" //just show a message over the actor showing that it is moving.
}
}
If some one can help me...
Thanks.
Can you upload this sample to somewhere for me to download it?
thank you very much. You saved my day.
papiomitis at yahoo dot com