mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 16:39:34 +00:00
Update to use modules
This commit is contained in:
parent
bc605465ac
commit
a044da16fe
1 changed files with 8 additions and 4 deletions
|
@ -4,6 +4,10 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
var MATH_CONST = require('../math/const');
|
||||
var WrapAngle = require('../math/angle/Wrap');
|
||||
var Transform = require('./Transform');
|
||||
|
||||
/**
|
||||
* A BaseTransform class that you can use when extending Game Objects.
|
||||
* Hides away the 'private' stuff and exposes only the useful getters and setters
|
||||
|
@ -12,7 +16,7 @@
|
|||
*/
|
||||
var BaseTransform = function (x, y)
|
||||
{
|
||||
this.transform = new Phaser.Component.Transform(this, x, y);
|
||||
this.transform = new Transform(this, x, y);
|
||||
};
|
||||
|
||||
BaseTransform.prototype.constructor = BaseTransform;
|
||||
|
@ -199,12 +203,12 @@ Object.defineProperties(BaseTransform.prototype, {
|
|||
|
||||
get: function ()
|
||||
{
|
||||
return Phaser.Math.wrapAngle(this.rotation * Phaser.Math.RAD_TO_DEG);
|
||||
return WrapAngle(this.rotation * MATH_CONST.RAD_TO_DEG);
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.rotation = Phaser.Math.wrapAngle(value) * Phaser.Math.DEG_TO_RAD;
|
||||
this.rotation = WrapAngle(value) * MATH_CONST.DEG_TO_RAD;
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -228,7 +232,7 @@ Object.defineProperties(BaseTransform.prototype, {
|
|||
this.transform._rotation = value;
|
||||
this.transform.dirty = true;
|
||||
|
||||
if (this.transform._rotation % Phaser.Math.PI2)
|
||||
if (this.transform._rotation % MATH_CONST.PI2)
|
||||
{
|
||||
this.transform.cache.sr = Math.sin(this.transform._rotation);
|
||||
this.transform.cache.cr = Math.cos(this.transform._rotation);
|
||||
|
|
Loading…
Reference in a new issue