Last active
October 4, 2016 18:52
-
-
Save pixelhijack/f5bd8e1f64b4882299992b52d538c1bf to your computer and use it in GitHub Desktop.
[Phaser.js] Extended / custom sprites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Lizardman(game, x, y, sprite){ | |
this.game = game; | |
Phaser.Sprite.call(this, game, x, y, sprite); | |
this.game.add.existing(this); | |
this.game.physics.enable(this, Phaser.Physics.ARCADE); | |
this.anchor.setTo(0.5, 0.5); | |
} | |
Lizardman.prototype = Object.create(Phaser.Sprite.prototype); | |
Lizardman.prototype.constructor = Lizardman; | |
Lizardman.prototype.update = function(){ | |
// will be called in every gamestate.update phase | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment