How Can I make the Game not start until a button is pushed
HappyGOLUCKY
Member, PRO Posts: 102
hey guys, issue.
Here's what I have, when I get to the game screen a page is set on the game screen page a bit transparent and it gives instructions on how to play the game. There are things that move around in my game and they are moving around in the background while the instructions page is there. What I want is when I get to the game screen nothing is happening in the background, basically the game is on pause until the person touches the screen (transparent button). How can I do this?
Thank you.
Answers
Do you mean the play button on the menu screen or like once your on the playing screen, you have to press a start button to start playing?
Personally, I find the easiest way to do this is to have your transparent instructions as a separate scene (let's call it LevelStart). At game start, pause the game calling LevelStart. This will pause your game and call the LevelStart scene over the top. Either make a "continue" button on LevelStart scene or just have it when you click anywhere it unpauses the game and then you'll return to your main scene. Hope that helps!
I use an integer game attribute called GameState. As an integer you can reuse that attribute for many things.
For example:
GameState = 0 you use for the initialization, loading of spawned items or something.
GameState = 1 you use this for allowing when you can press the button to start the game by incrementing GameState
GameState > 1 game has started
And even more states..
GameState = 2 Normal enemy get spawned on the screen or cards are dealt and bet needs to be made
GameState = 3 Boss battle or waiting for others to make their bet.
etc
@CodeMonkey Could you explain further on how to implement this method?