tux4kids / Tux4ME

A mind exercise game by Tux4Kids organization developed under Google summer of Code - 2015
GNU General Public License v3.0
19 stars 28 forks source link

Separate Pause logic from Replay logic and make the code more modular. #37

Open AkshayAgarwal007 opened 8 years ago

AkshayAgarwal007 commented 8 years ago

We should separate the pause logic from the replay logic and make the code more modular so that it would be easy for a new developer to pick up parts of code and develop a new level. The replay logic shouldn't have any relation with the pause logic.

This is different from the issue #1. This is not concerned with replacing the use of pauseState with game.paused but with separating the pause logic from replay logic and using better graphics to represent the same. function replayGame() { pause.destroy(); pause = game.add.sprite(575,455,'pause'); pause.inputEnabled = true; tempText = game.add.text(470, 470 , ' ' , {font : "15px Arial" , fill : "#eceff1"}); pauseState = 1; pauseAndPlay(); // The replay function shouldn't make use of this. score = 0; displayScore = 0; myscore.setText('000'); timer.setText('00:00:00')

pauseAndPlay(); // This replay function shouldn't make use of this.

AkshayAgarwal007 commented 8 years ago

https://github.com/Vigneshsekar/Tux4ME/pull/38. I have fixed this for mindmath.js. This would require a similar implementation for other games as well.