Skip to content

Instantly share code, notes, and snippets.

@amadeus
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amadeus/2f2aa6601bcf1052a984 to your computer and use it in GitHub Desktop.
Save amadeus/2f2aa6601bcf1052a984 to your computer and use it in GitHub Desktop.
/** nanobot */
var Nanobot = function(game, x, y) {
// extends
Phaser.Sprite.call(this, game, x * pxr, y * pxr, 'nanobot', 'nanobot-180');
// members
this.hoverBase = 6;
this.hoverEffect = game.add.tween(this);
// defaults
this.scale.set(2);
this.anchor.set(0.5);
}
Nanobot.prototype = Object.create(Phaser.Sprite.prototype);
Nanobot.prototype.constructor = Nanobot;
Phaser.Utils.mixin({
update: function(){
var dt = Phaser.Time.elapsed;
this.y += 1;
Phaser.Sprite.prototype.update.apply(this, arguments);
}
}, Nanobot.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment