Jump to content

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


kishan
 Share

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,

Link to comment
Share on other sites

Hello! I may misunderstand what you're asking but in my game I switch between states via code like this.
 

this.game.state.start('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!

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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