Sign in to follow this  
AbdSab

Restart state completely

Recommended Posts

Hi all 

 

I have a big problem:

 

At the game over scene which is in the same of the game state, i have two button replay and main menu

 

When i click replay which have the function:

 

 

this.game.state.restart(false,true);

 

The state restart but when i click at the place where the button was, the state restate again.

 

I think that the button is not destroyed just the sprite which is destroyed, i have tried button.kill() and button.destroy() before restating state but i get an error.

 

And when i do : 

 

 

this.game.state.restart();

 

I get an error of an undefined velocity ......., 

 

The question is, is there any way to restart the state like if it's the first time the state is started ??

Share this post


Link to post
Share on other sites

But it's the same as 

 

 

this.game.state.restart();

:'(

 

EDIT:

Nevermind i've found a way, it's to add this function:

 

 

shutdown: function() {

     this.game.world.removeAll();
   }

 

Thank's anyway

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.