Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

State Change Problem


zxxz
 Share

Recommended Posts

Hello, 

 

I have set up a game which uses states as per the template which is working fine. I have registered the event: 

player.events.onOutOfBounds.add(this.playerOut, this); 

and have the function:

playerOut: function()    {        this.game.state.start('MainMenu');    },

When the player goes out of bounds to the left of the world then the game state successfully changes to the main menu. However, if the player falls through the bottom or the right side of the world then the main menu state does not correctly appear but there is something happening. Is it the way in which I have attempted to do accomplish this which is causing the problem? 

 

Also what kind of clean up should I be doing in the playerOut function to clear up resources? 

 

Thank you.

Link to comment
Share on other sites

Maybe you are running into a problem similar to mine.

For me the solution was in resizing the world to game-size in the create method of the menu-state. (because my tilemap had made it bigger and my button placement was off because of it.)

 

Details here:

 

http://www.html5gamedevs.com/topic/3359-camera-not-positioned-correctly-after-changing-start-away-from-scrolling/?view=findpost&p=22566

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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