tel-ran-de / FE12-Basic

2 stars 12 forks source link

2020-11-30 - finishing games cycle #118

Open isalexlog opened 3 years ago

isalexlog commented 3 years ago

We need to implement some solution not to have an endless game. To do this we will introduce maximum game time and we set it to 30 seconds.

Phase I 1) Add new field to the score object that will display the time remaining to the end of the game. 2) Save the game starting time to some global variable before the game starts 3) Introduce some flag variable reflecting of the game has ended or not 4) Before updating the game objects (background, monsters, hero, score), check the time till the end of the game. If there is not time left, set the game ended flag to true. If not, decrease the time till the end of the game. 5) Before updating the game objects check the game ended flag. If flag is set to true,

Phase II 1) Add text "If you want to play again, press Space" to the GameOverObject 2) Monitor if Space is pressed, and if yes, start new game.