mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Weapon.Fire now tracks offset rotation
This commit is contained in:
parent
f2daaec98c
commit
383f14cb3f
1 changed files with 22 additions and 4 deletions
|
@ -730,14 +730,32 @@ Phaser.Weapon.prototype.fire = function (from, x, y) {
|
|||
}
|
||||
else if (this.trackedSprite)
|
||||
{
|
||||
if (this.fireFrom.width > 1)
|
||||
if (this.trackRotation)
|
||||
{
|
||||
this.fireFrom.centerOn(this.trackedSprite.world.x + this.trackOffset.x, this.trackedSprite.world.y + this.trackOffset.y);
|
||||
rotatedPoint = new Phaser.Point(this.trackedSprite.world.x + this.trackOffset.x, this.trackedSprite.world.y + this.trackOffset.y);
|
||||
rotatedPoint.rotate(this.trackedSprite.world.x, this.trackedSprite.world.y, this.trackedSprite.rotation);
|
||||
|
||||
if (this.fireFrom.width > 1)
|
||||
{
|
||||
this.fireFrom.centerOn(rotatedPoint.x, rotatedPoint.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fireFrom.x = rotatedPoint.x;
|
||||
this.fireFrom.y = rotatedPoint.y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fireFrom.x = this.trackedSprite.world.x + this.trackOffset.x;
|
||||
this.fireFrom.y = this.trackedSprite.world.y + this.trackOffset.y;
|
||||
if (this.fireFrom.width > 1)
|
||||
{
|
||||
this.fireFrom.centerOn(this.trackedSprite.world.x + this.trackOffset.x, this.trackedSprite.world.y + this.trackOffset.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fireFrom.x = this.trackedSprite.world.x + this.trackOffset.x;
|
||||
this.fireFrom.y = this.trackedSprite.world.y + this.trackOffset.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bulletInheritSpriteSpeed)
|
||||
|
|
Loading…
Reference in a new issue