Update to use modules

This commit is contained in:
vulvulune 2017-01-16 23:07:55 +01:00
parent bc605465ac
commit a044da16fe

View file

@ -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);