TileSprites can now receive full Input events, dragging, etc and be positioned in-world and fixed to cameras (fixes #321)

This commit is contained in:
photonstorm
2014-02-21 19:21:00 +00:00
parent ee1a1cd1c9
commit 57796a60be
4 changed files with 125 additions and 0 deletions
+16
View File
@@ -730,6 +730,22 @@ Phaser.Input.prototype = {
return false;
}
else if (displayObject instanceof Phaser.TileSprite)
{
var width = displayObject.width;
var height = displayObject.height;
var x1 = -width * displayObject.anchor.x;
if (this._localPoint.x > x1 && this._localPoint.x < x1 + width)
{
var y1 = -height * displayObject.anchor.y;
if (this._localPoint.y > y1 && this._localPoint.y < y1 + height)
{
return true;
}
}
}
else if (displayObject instanceof PIXI.Sprite)
{
var width = displayObject.texture.frame.width;