I created an intro layer page for a help menu. It's the first thing you see/read on game load before you click the button to play the game.
While in game play there is a help button to take you back to the intro just in case you really do need to read the how to info of the game.
However, when you click the button to bring up the menu and then click the button on the menu to get back to the game it restarts the game.
So any points you may have collected are lost. Plus if you get into a tight spot you can use it as an exploit to not lose a life and keep your score.
How can I make it so it pauses the game while you look and the help menu and then when you click back it starts right in the same place?
I have tried setting the time value and the layer value (Yeah that one was a disaster) but nothing works. Also on 1st load while looking at the menu I don't wont the game to run in the background until you hit the play game button.
Thank you in advance...
ALLMarkMade You can use the Pause plugin by Rexrainbow... check this Pause plugin link
Oh wow, ok, thank you, I will check it out...
Make sure that everything that moves will move based on DT, then setting the time scale to 0 will pause everything that moves.
Also, hook time scale to a boolean (Pause = 0 or 1 for off and on). That way, you can also selectively ignore player input on keys and buttons if the pause boolean is true.
You can also use the persistent behavior on your objects too.
After thinking about it for a second and not giving a kneejerk response, I think as mentioned above, using delta time to stop movement, and then the persistent behaviors to make sure everything stays in place, might be the best bet.
I kinda fixed that problem and from reading all your suggestions I'll have to work on how I implement things. However, now my new problem which I think is part of the original question is the every random Secs.
Even when everything is paused (or so I think) the random Secs keep counting. So even when I'm on the intro page everything is still spawning (Not moving but spawning) so when I click the play game i'm over run with spawns.
So if I leave it on the intro page for a while I have more spawns then I can handle.
BTW, the Pause Plugin did not work or I couldn't make it work.
Thanks in advance as I am still learning an probably could havelaid everything out much better.
ALLMarkMade Use a global variable as a sort of Boolean. Use the on Start of layout and on end of layout for your instruction page to turn it "on" or "off" Add a second condition for your exvery random seconds to see if the "boolean" is true.
so, for example
Global variable IsPaused = 0 ; 0 will be false, 1 will be true to keep to conventions.
On start of layout for instructions page, IsPaused = 1 (set value)
on end of layout (instruction page), IsPaused = 0 (set value)
Add the extra condition, if IsPaused = 0 AND Every X Seconds
That should fix it easily enough.
Thank you... I will give this a shot, as long as I have a good direction I can figure it. I'll let you all know thanks for the help.
I think I have it set up according to what you said to do but I do not understand this part...
I understand it I don't know how to implement it. I don't see this option anywhere.
ALLMarkMade which option you do not see? If it is the Every X seconds, that is under System -> Time -> the option on the right says Every X seconds, you will have to enter a value or formula.
Hope this helps. I do not know why the Pause plugin did not work. Where you able to download and test the .capx example from the plugin?
I'm still learning and I'm sure it's something I'm doing wrong. I think I'm just going to start from scratch and make sure I organize and implement things a little better.
I did see the Every X seconds options but not after I set the IsPause.
I'm confused I'm sure.
Develop games in your browser. Powerful, performant & highly capable.
You basically want to add the IsPaused condition to your random generation algorithm (how ever you have that set up) So add the condition, IsPaused = 0 then randomly generate (or spawn) your object.
When you pause the game, you want to set IsPaused to 1. So if the game is paused then your random spawn generation should stop because IsPaused doesn't equal 0.
In more english terms, think of 1 as being true and 0 as being false. So you would say (assuming for you random spawn instructions), "If it is time to spawn an enemy (or object) and the game is not paused (IsPaused = 0) then go ahead and spawn an enemy."
Likewise, you would say, "When the game is paused then go ahead and set IsPaused equal to 1. When I unpause the game then go ahead and make IsPaused = to 0."
That way your game has a check to see if the game is paused. If it is, then don't do anything. But if it isn't paused and it's time to spawn something, then go ahead and do it.
Ok I will try that thank you....
gfigueroa, Yes I did see your link but that was (to my understanding) a pause button. I need something that when the game ends/resets the Spawn clock (Every X) starts from 1 so I don't have a thousand spawns if I'm reading the intro screen.
ALLMarkMade I did something similar, I setup the Pause button and if the LAYER for the intro is visible, set PAUSE state to Pause, this will stop the creation of spawns. It did work for me, my "intro" page was actually an in-game tutorial and in that way I was able to control the spawns until the player decided to press a key.