Restarting the game

At this moment, we have a very simple gameplay. We can ask the game to start and we know when the player is finished. All that's missing to complete the game loop is the ability to restart the game.

Restarting the game should be done by the user by pressing the button on the screen or by pressing the button on the keyboard. Let's use the same input event we already have to start the game. The main difference between starting and restarting the game is that actual conditions in the game might be much different. For example, the player's position in the game will be different. In fact, this is a good starting point. Let's make sure every time the game starts, the player's initial position is the same.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset