Jump to content

No text after state refresh


Recommended Posts


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 


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

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.
  • Create New...