mirror of
https://github.com/wassname/phaser.git
synced 2026-07-03 17:10:40 +08:00
Added Sprite.centerOn(x,y) and fixed the InputHander snap as a result.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user