Great new thrust ship example added for ScrollZones. Also added rotationOffset value to GameObject base class.

This commit is contained in:
Richard Davey
2013-04-23 21:27:45 +01:00
parent 00fb20f8c2
commit 6466361f5f
10 changed files with 129 additions and 24 deletions
+5
View File
@@ -76,6 +76,11 @@ module Phaser {
public origin: MicroPoint;
public z: number = 0;
// This value is added to the angle of the GameObject.
// For example if you had a sprite drawn facing straight up then you could set
// rotationOffset to 90 and it would correspond correctly with Phasers rotation system
public rotationOffset: number = 0;
// Physics properties
public immovable: bool;
+3 -3
View File
@@ -224,14 +224,14 @@ module Phaser {
}
// Rotation - needs to work from origin point really, but for now from center
if (this.angle !== 0 || this.flipped == true)
if (this.angle !== 0 || this.rotationOffset !== 0 || this.flipped == true)
{
this._game.stage.context.save();
this._game.stage.context.translate(this._dx + (this._dw / 2), this._dy + (this._dh / 2));
if (this.angle !== 0)
if (this.angle !== 0 || this.rotationOffset !== 0)
{
this._game.stage.context.rotate(this.angle * (Math.PI / 180));
this._game.stage.context.rotate((this.rotationOffset + this.angle) * (Math.PI / 180));
}
this._dx = -(this._dw / 2);