How to know if all physics bodies are stopped.

scrapee_netscrapee_net Member Posts: 424
edited November -1 in Working with GS (Mac)
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.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    You could have a rule in each one falling and a attribute called stopped. You can set stop to zero. Then in each falling actor have a rule when motion linear y=0 change attribute stoppped to stopped+1. Then depending on your amout of actors, say you have ten, when attributed stopped equals ten do whatever. Then youll know if it stopped or not depending on that.
  • scrapee_netscrapee_net Member Posts: 424
    Unfortunately this method doesn't work, due to the fact that, if the actor bounce for example, the attribute stopped will be increased by more than just 1. Every bounce, it will increase stooped in 1, so it's not the solution.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
  • scrapee_netscrapee_net Member Posts: 424
    Will this work? My actors can also be dragged by the user....
  • scrapee_netscrapee_net Member Posts: 424
    Im trying since tomorrow morning how to find a solution. Im almost giving up and going to corona...
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    sabaterwb said:
    Im trying since tomorrow morning how to find a solution. Im almost giving up and going to corona...

    And spend 300 dollars?.... Nothing in game develeopment is ever easy, and it usueally takes alot longer then a day to get things working how you want them
  • RattleheadRattlehead Member Posts: 485
    sabaterwb said:
    Im trying since tomorrow morning how to find a solution. Im almost giving up and going to corona...

    Are you sure you could saunter over to Corona and code this yourself? If you think this is tough in GameSalad, I can ensure you that it will probably be even more difficult when you have to roll your own solution in Lua.

    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!
  • scrapee_netscrapee_net Member Posts: 424
    What is making me crazy is the fact that the problem looks to be something not possible to do using gamesalad. I'll try to explain again.

    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.
  • scrapee_netscrapee_net Member Posts: 424
    Yes. Then when no blocks are moving anymore, i need to just go to next level.
    Can you upload this sample to somewhere for me to download it?

    thank you very much. You saved my day.
  • scrapee_netscrapee_net Member Posts: 424
    hello. I just sent you my email address. sabater_wb at hotmail dot com
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Hey Tshirt would you be able to send me the demo you just made?

    papiomitis at yahoo dot com
Sign In or Register to comment.