Jump to content

On restart, life counter goes down by one


joshbivens
 Share

Recommended Posts

I added a 'restart' icon that runs a restart function when clicked, but if you click it at any time before the 'Game Over' screen, it restarts just fine but after a second the lives counter goes down by one. The only delay timer I have is the Webfonts loader, so I'm confused.

 

The project in question: https://github.com/joshbivens/breakout-pipboy

Thanks for your time!

Link to comment
Share on other sites

I suspect this is due to the fact that you don't restart a game state, you manually 'restart' everything. So maybe the ball from your previous game session still does exist, goes out of bounds and causes you to lose a life. You should use a Game State, and basically just restart it. The code would be much easier, shorter, and guaranteed to work.

Link to comment
Share on other sites

I suspect this is due to the fact that you don't restart a game state, you manually 'restart' everything. So maybe the ball from your previous game session still does exist, goes out of bounds and causes you to lose a life. You should use a Game State, and basically just restart it. The code would be much easier, shorter, and guaranteed to work.

 

Thank you very much. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...