Jump to content

Is it safeto have many states in Phaser?


caiser
 Share

Recommended Posts

Hello guys,

 

I am building a puzzle game which has more than 100 levels.

For each puzzle/level, I am planning to create a state, so for example I will be having: level1.js, level2.js, ... level100.js

 

Is this a good practice or it might raise few issues ?

 

Thanks

Link to comment
Share on other sites

It's not how I'd do it personally (I'd have a more generic Level State that loads in what it needs each time), but having said that I still can't see a problem with having 100 states. As long as you clean up on the state shutdown, so nothing lingers in memory when it shouldn't do, it should be fine. States are generally really light-weight. You could eat up more memory in a single sprite texture than in 100 states. It's just the gc to be careful of.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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