BaltaXZ Posted July 13, 2016 Share Posted July 13, 2016 Trying to understand state handling in Phaser. In this simple example, why does the following code log "Menu State" followed by "Game state" in the console? I would expect it to only write "Menu state", since I have not switched states anywhere in the code. var game; game = new Phaser.Game(800, 600); game.state.add("Menu", state_menu); game.state.add("Game", state_game); game.state.start("Menu"); function state_menu() { console.log("Menu state"); this.update = function () { } } function state_game() { console.log("Game state"); this.update = function () { } } Link to comment Share on other sites More sharing options...
BaltaXZ Posted July 13, 2016 Author Share Posted July 13, 2016 Ok, I reply myself; the reference should be an object, not a function. Link to comment Share on other sites More sharing options...
Recommended Posts