frokenstein

Sprites disappear after restarting game

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.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.