I'm following this tutorial, https://phaser.io/examples/v2/sprites/extending-sprite-demo-2, and I have the following:
MonsterBunny = function (game, x, y, rotateSpeed) {
Phaser.Sprite.call(this, game, x, y);
var test = game.add.sprite(x, y, 'player');
test.rotateSpeed = rotateSpeed;
};
MonsterBunny.prototype = Object.create(Phaser.Sprite.prototype);
MonsterBunny.prototype.constructor = MonsterBunny;
MonsterBunny.prototype.update = function() {
this.angle += this.rotateSpeed;
console.log('a');
};
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
function preload() {
game.load.crossOrigin = 'anonymous';
game.load.image('player', 'http://examples.phaser.io/_site/images/prize-button.png');
}
function create() {
var wabbit = new MonsterBunny(game, 0, 100, 1);
var wabbit2 = new MonsterBunny(game, 150, 100, 0.5);
}
The sprites don't spin and the update function doesn't log to the console any more. How do I fix this? Thanks.