Jump to content

Phaser First Project


ronarev
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

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