Skip to content

Instantly share code, notes, and snippets.

@pixelhijack
Last active October 4, 2016 18:52
Show Gist options
  • Save pixelhijack/f5bd8e1f64b4882299992b52d538c1bf to your computer and use it in GitHub Desktop.
Save pixelhijack/f5bd8e1f64b4882299992b52d538c1bf to your computer and use it in GitHub Desktop.
[Phaser.js] Extended / custom sprites
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