ronarev Posted January 16, 2016 Share Posted January 16, 2016 I just started with the first project, and I'm getting an error in the console: undefined is not an object (evaluating 'this.sprite.angle'). Not sure why, I'm assuming it has something to do with the phaser.min.js file. My main.js file is as follows: var mainState = { preload: function() { //excecute function //this is wher ewe load the games assests game.load.image('logo', 'logo.png') }, create: function() { //loads after the preload //set up the games sprites this.spirte = game.add.sprite(400, 250, 'logo'); }, update:function() { this.sprite.angle += 1; } }; //We initalising Phaser var game = new Phaser.Game(400, 300, Phaser.AUTO, 'gameDiv'); //Tell Phaser to add and start our 'main' state game.state.add('main', mainState); game.state.start('main'); Link to comment Share on other sites More sharing options...
end3r Posted January 16, 2016 Share Posted January 16, 2016 It looks like you made a typo: this.spirte = game.add.sprite(400, 250, 'logo'); You have this.spirte variable and trying to change the value of angle on this.sprite variable in the update function. Link to comment Share on other sites More sharing options...
Recommended Posts