smdool

Members
  • Content count

    5
  • Joined

  • Last visited

  1. init parameters is undefined

    Thanks @jamespierce. I think the issue is because I had previously been using phaser-state-transition.min.js to animate state transitions. I had recently stopped using phaser-state-transition while I was testing something out but hadn't removed the script tag from index.html. This appeared to be overriding the normal this.game.state.start function.
  2. init parameters is undefined

    @jamespierce It has showing as undefined in the CongratulationsState. I'll update my original post.
  3. init parameters is undefined

    Thanks for the suggestion @FenopiĆ¹, I'll give that a go. I haven't got an link available at the moment @jamespierce, as soon as I do I'll let you know.
  4. init parameters is undefined

    In Phaser 2.7.5 I'm trying to pass an object as a parameter from one state to another but the object is showing as undefined. Below is the code from GameState whereby I'm looking to pass an object containing a score, time and seconds. this.game.state.start( "Congratulations", true, false, { score: this.killedGerms, time: this.timeLabel.text, seconds: this.remainingSeconds }); Below is the CongratulationsState where the parameter, "data", is coming through as "undefined". init: function(data) { console.log('data', data); data = data || { score: 0, time: "00:00", seconds: 0 }; } Any ideas on where I have gone wrong would be greatly appreciated.
  5. I am looking to extend the Phaser tutorial "Making your first Phaser game" (http://phaser.io/tutorials/making-your-first-phaser-game) by introducing states as described in this post "Understanding Phaser states" (http://www.emanueleferonato.com/2014/08/28/phaser-tutorial-understanding-phaser-states/) The Update function in my play.js provides an overlap callback to a custom function called gameOver (line 161). It is at this point on line 179 whereby this.game, and hence 'state', is undefined as 'this' is now referring to the custom function. The tutorial 'understanding Phaser states' references this.game inside custom functions yet doesn't error. Hoping someone could point myself in the right direction in resolving this issue. The code can be viewed on Github https://github.com/smdooley/PhaserDemo/blob/master/tutorial-03/play.js