mirror of
https://github.com/wassname/phaser.git
synced 2026-08-15 12:45:11 +08:00
Great new thrust ship example added for ScrollZones. Also added rotationOffset value to GameObject base class.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user