bluedot Posted July 15, 2014 Share Posted July 15, 2014 It may be a Javascript thing, but I can't do the following in an object. setTimeout(function(){this.startGame();}, 5000); Should I replace "this" with the fully qualified name ? e.g. game.state.states.MyGame.startGame() Thanks. Link to comment Share on other sites More sharing options...
bluedot Posted July 15, 2014 Author Share Posted July 15, 2014 That did work, so I suppose it was a JS thing. Link to comment Share on other sites More sharing options...
lewster32 Posted July 15, 2014 Share Posted July 15, 2014 Don't use setTimeout in Phaser - under the hood Phaser has some quite specific time requirements, so using Phaser's Timer events instead will prevent a lot of headaches with things happening out of sequence:game.time.events.add(5000, function() { this.startGame();}, this);The last parameter is the context the function will be called in. In this case, it's the same context as that the event is being created in. casarock and codevinsky 2 Link to comment Share on other sites More sharing options...
Recommended Posts