How to keep my state active even if moved to next state.

Recommended Posts

Hi All,

         I am new to phaser and going through it and i came across state in phaser. I need to know if i can maintain my pervious state active in the background so that i can be able to handle assets loading in the active without getting caught in the Phaser.cache.getImage error.

Thanks in advance,

Share this post

Link to post
Share on other sites

Hello! I may misunderstand what you're asking but in my game I switch between states via code like this.'MainMenu', true, false);

That third parameter that's passed as false indicates whether the game cache should be cleared. Here's the exact phrasing:

@param clearCache — Clear the Game.Cache? This purges out all loaded assets. The default is false and you must have clearWorld=true if you want to clearCache as well.

As long as you're passing it as false (or not passing it at all as the default value is false) you should not have trouble loading assets just because you switched state. 

Let us know if that helps!


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.

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.


  • Recently Browsing   0 members

    No registered users viewing this page.