views:

41

answers:

1

I have writing a small shooting game in cocos2d. Winning the game is to eliminate all the 10 enemies. After that end screen comes showing 'You Won' and 'Play Again'. If I go for 'Play Again' option the game is starting from where I need. But, the problem is that the game is continuing from previously ended state. I mean it is not starting from enemy 1 again instead it is just showing the end of 10 enemy. I think I have to reset all the values before pushing the scene. But should I reset all the values I have used or there is any other way ?

Thank You.

+1  A: 

Resetting the state seems a logical choice.

It would probably make for cleaner code if you re-factor so all your game state related information is held in one instance of a GameState object. Then it could have a method reset that puts values back as you want them.

Kindness,

Dan

Daniel Elliott
Thank You Daniel.
srikanth rongali