pause and unpause

hi,
I tried this custom pause system which was shown by @tshirtbooth



but it does not work well with games like these or where balls are spawned from a canon



I dont wanna use pause which gamesalad provides as it loads a new scene on the current scene.
Is there any alternative method to pause the game??

Best Answer

Answers

  • djdeedjdee Member Posts: 180
    You could use the 'regular' pause behavior and just use and empty (or nearly empty) scene. That way there would be little to no delay for the scene load.
    Thanks @jamie_c,
    I think thats the best way to approach this.... :)

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    You'll need to freeze all actors with physics applied to them otherwise they will continue moving a fraction before the pause fully kicks in. I had the same problem with mine. I achieved it by storing the current position, velocity, and rotation into attributes when the pause button was pressed, and also constrained the actor to those positions. This was all before the pause behaviour.

    You'll need a pause Boolean attribute that is set to true as soon as the pause button is pressed, but before the pause behaviour, and it's that attribute you can use to store the actors position, velocity and rotation before constraining them etc. I think for velocity I constrained it to 0 while it was paused and when I unpaused it I set it back to the value I stored in an attribute before pausing, so that it would continue along it's original path
  • djdeedjdee Member Posts: 180
    You'll need to freeze all actors with physics applied to them otherwise they will continue moving a fraction before the pause fully kicks in. I had the same problem with mine. I achieved it by storing the current position, velocity, and rotation into attributes when the pause button was pressed, and also constrained the actor to those positions. This was all before the pause behaviour.

    You'll need a pause Boolean attribute that is set to true as soon as the pause button is pressed, but before the pause behaviour, and it's that attribute you can use to store the actors position, velocity and rotation before constraining them etc. I think for velocity I constrained it to 0 while it was paused and when I unpaused it I set it back to the value I stored in an attribute before pausing, so that it would continue along it's original path
    Hi @KevinCross
    Thank you. I tried ur method, But still after i unpause , the actor just falls down.
    what have i done is, when the pause is false i have constrained position, velocity, and rotation to my attributes, and when the pause is true i have changed attribute of position, velocity, and rotation to my attributes and for 0.2 sec constrain the velocity and rotation to 0.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Hi @KevinCross
    Thank you. I tried ur method, But still after i unpause , the actor just falls down.
    what have i done is, when the pause is false i have constrained position, velocity, and rotation to my attributes, and when the pause is true i have changed attribute of position, velocity, and rotation to my attributes and for 0.2 sec constrain the velocity and rotation to 0.
    I think that's what I said (except for the 0.2 seconds bit)... glad you got it working.

  • bufteabuftea Member Posts: 43

    Hello! I know it's an old post but I don't want to start a new thread on the subject.

    My spawned actors disappear when I unpause the game using this technique.

    My game starts with pause.atribute (integer) = 0

    When I pause, pause.atribute = 1
    When I unpause, pause.atrribute = 2

    My "spawner" spawns every 3 seconds when pause.atribute = 0 or 2.

    I use the changeSecene Behavior the switch from pause.Scene to playGame.Scene and in revers also .

    Why do my spawned actors disappear when I unpause?

  • youdvdkyoudvdk Member, PRO Posts: 21

    @djdee Just remember for pausing that the order of operations matters. Lets say if you press the pause button and spawn the pause scene (or something) then change game.pause to 1 then it will do it in that order. If you would change game.pause first maybe that will be better because that will stop everything first and then do what you need to be done. That way there might not be a delay.
    @buftea I would try to have pause.attribute only have two states, 0 and 1. Maybe try that and then we can see from there.

Sign In or Register to comment.