Jump to content

No text after state refresh


Keenic
 Share

Recommended Posts

Hi,

I'm creating a game restart and after change state text won't appear.

Code to create text:

this.game.add.text(45, 220, '0', {fill: '#fff'});

And after that, this text show on state but when i change state by 

this.state.start('Start');

the text just diseappear.

Link to comment
Share on other sites

The second parameter to StateManager.start (the method you're calling there) is "clearWorld". It defaults to true. If you don't want the text to disappear, you can either pass "false" as the next argument to start, or you can add the text directly to the stage ("game.stage.add(this.game.make.text(...").

Link to comment
Share on other sites

I don't worry about performance until performance is worth worrying about. If you're seeing performance problems start fixing them. Before then, you're guessing where the problem is... and it's probably *way* more fun to work on your actual game. :)

I *am* careful about unsubscribing my signals, but that's mostly because it causes bugs when you're on the main menu and you still have the spacebar trying to make the player jump, for example.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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