Pausing an actor that is accelerating?

GamersRejoiceGamersRejoice Member Posts: 817
edited November -1 in Working with GS (Mac)
I have some actors accelerating down and I want them to stop when I pause the game. Currently when I pause the game they keep moving and hit other objects and fly around like there is 0 gravity. Pretty cool, but not what I'm looking for. Any tips?

Comments

  • osucowboy18osucowboy18 Member Posts: 1,307
    All you have to do to fix this is add/modify a simple rule. For each actor that accelerates, make sure you include the following rule. The rule should state that if game.Paused (or whatever you named your pause attribute) is False, then allow the actor to accelerate, but if game.Paused is True, do not allow the actor to accelerate. Make sure you change game.Paused to true anytime the game is paused, and then back to false when the game is resumed. Hope this helps.

    - Alex
  • GamersRejoiceGamersRejoice Member Posts: 817
    I got this working, however it doesn't stop them from moving once paused. They still float around but the acceleration behavior has definitely stopped.
  • FanStudioUKFanStudioUK Member Posts: 459
    It's not working like this for the accelerating objects, instead what you should do is to constrain X.position and Y.position of the actor that is accelerating. And having a rule on an actor each time pause is false to spawn the actor to the constrain position and on the accelerating actor to be destroyed when pause is true.

    Hope it make sense :)

    Cheers
  • GamersRejoiceGamersRejoice Member Posts: 817
    That would work but I'm pushing GameSalad as it is and can't afford to constrain more invisible actors. I've been experimenting with changing attribute self.physics.movable to false but can't seem to get that to work. Anybody tried this method before?
  • FanStudioUKFanStudioUK Member Posts: 459
    This is the only option on pausing accelerating actors. I used this method in my game and works fine. You should give it a try unless you have on the scene 100 accelerating actors :)
  • GamersRejoiceGamersRejoice Member Posts: 817
    That worked great, thanks.
  • GamersRejoiceGamersRejoice Member Posts: 817
    Ok I take that back it didn't work perfectly. :) Now the actors switch positions with the other actors when I pause and un-pause
Sign In or Register to comment.