Added Sprite.centerOn(x,y) and fixed the InputHander snap as a result.

This commit is contained in:
Richard Davey
2013-09-13 04:37:06 +01:00
parent 62d77e7038
commit fd0a071cb3
4 changed files with 117 additions and 8 deletions
+11
View File
@@ -313,6 +313,17 @@ Phaser.Sprite.prototype.preUpdate = function() {
}
/**
* Moves the sprite so its center is located on the given x and y coordinates.
* Doesn't change the origin of the sprite.
*/
Phaser.Sprite.prototype.centerOn = function(x, y) {
this.x = x + (this.x - this.center.x);
this.y = y + (this.y - this.center.y);
}
Phaser.Sprite.prototype.revive = function() {
this.alive = true;