Jump to content

Sprites disappear after restarting game


frokenstein
 Share

Recommended Posts

I've tried everything I could think of in the shutdown() function but when I restart a game I cannot get it to restart in the same state it was in when I first loaded it in my browser. When my game ends there is a prompt to restart and when the user clicks the mouse, this function is called:

this.game.state.start('Game', true, false);

It seems to do its job but for whatever reason the alien ship sprite and its accompanying map sprite are invisible despite the fact that I can verify they're created. Not incidentally, this is the same function that starts the game the first time. I am perplexed why the exact same function wouldn't work the same way when called a second time.

 

You can see it in action here:

 

http://joelsaxton.github.io/starpatrol/

 

I've tried about six different ways to shutdown() the game but to no avail. My guess is the sprites are not being added to the game object (or something?) but I have to wonder why the same function which sets up the game would do it differently the second time it runs.

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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