Sign in to follow this  
Wunderforce

Restarting a Phaser State is Resetting Global Variables

Recommended Posts

I have a global object called "params" that stores a lot of important parameters for my game.  I define params in a "main.js" file that initializes the game, defines my states and parameters, and then calls my "bootState". 

For some reason, when I restart my "gameState" (another state, defined in "gameState.js") it resets my "params" object to the values it was initialized with in "main.js".

My goal is to change some parameters via "params" in the console, then restart "gameState" and have it reflect those changed parameters.

If needed I can provide some example code.

Share this post


Link to post
Share on other sites

Personally I prefer old threads stay up so people with the same problem can read them and figure out where they're going wrong. They fall down the list pretty quickly so will be buried before you know it :)

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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.