Fixed all the bounds methods to use origin instead of anchor.

This commit is contained in:
Richard Davey 2017-03-27 23:09:54 +01:00
parent 91f3861ad7
commit 6d6af08cae
14 changed files with 18 additions and 18 deletions

View file

@ -7,7 +7,7 @@
var GetBottom = function (gameObject)
{
return (gameObject.y + gameObject.height) - (gameObject.height * gameObject.anchorY);
return (gameObject.y + gameObject.height) - (gameObject.height * gameObject.originY);
};
module.exports = GetBottom;

View file

@ -7,7 +7,7 @@
var GetCenterX = function (gameObject)
{
return gameObject.x - (gameObject.width * gameObject.anchorX) + (gameObject.width * 0.5);
return gameObject.x - (gameObject.width * gameObject.originX) + (gameObject.width * 0.5);
};
module.exports = GetCenterX;

View file

@ -7,7 +7,7 @@
var GetCenterY = function (gameObject)
{
return gameObject.y - (gameObject.height * gameObject.anchorY) + (gameObject.height * 0.5);
return gameObject.y - (gameObject.height * gameObject.originY) + (gameObject.height * 0.5);
};
module.exports = GetCenterY;

View file

@ -7,7 +7,7 @@
var GetLeft = function (gameObject)
{
return gameObject.x - (gameObject.width * gameObject.anchorX);
return gameObject.x - (gameObject.width * gameObject.originX);
};
module.exports = GetLeft;

View file

@ -1,7 +1,7 @@
/**
* The amount the Game Object is visually offset from its x coordinate.
* This is the same as `width * anchor.x`.
* It will only be > 0 if anchor.x is not equal to zero.
* This is the same as `width * origin.x`.
* It will only be > 0 if origin.x is not equal to zero.
*
* @property {number} offsetX
* @readOnly
@ -9,7 +9,7 @@
var GetOffsetX = function (gameObject)
{
return gameObject.width * gameObject.anchorX;
return gameObject.width * gameObject.originX;
};
module.exports = GetOffsetX;

View file

@ -1,7 +1,7 @@
/**
* The amount the Game Object is visually offset from its x coordinate.
* This is the same as `width * anchor.x`.
* It will only be > 0 if anchor.x is not equal to zero.
* This is the same as `width * origin.x`.
* It will only be > 0 if origin.x is not equal to zero.
*
* @property {number} offsetX
* @readOnly
@ -9,7 +9,7 @@
var GetOffsetY = function (gameObject)
{
return gameObject.height * gameObject.anchorY;
return gameObject.height * gameObject.originY;
};
module.exports = GetOffsetY;

View file

@ -7,7 +7,7 @@
var GetRight = function (gameObject)
{
return (gameObject.x + gameObject.width) - (gameObject.width * gameObject.anchorX);
return (gameObject.x + gameObject.width) - (gameObject.width * gameObject.originX);
};
module.exports = GetRight;

View file

@ -7,7 +7,7 @@
var GetTop = function (gameObject)
{
return gameObject.y - (gameObject.height * gameObject.anchorY);
return gameObject.y - (gameObject.height * gameObject.originY);
};
module.exports = GetTop;

View file

@ -7,7 +7,7 @@
var SetBottom = function (gameObject, value)
{
gameObject.y = (value - gameObject.height) + (gameObject.height * gameObject.anchorY);
gameObject.y = (value - gameObject.height) + (gameObject.height * gameObject.originY);
return gameObject;
};

View file

@ -12,7 +12,7 @@
var SetCenterX = function (gameObject, x)
{
var offsetX = gameObject.width * gameObject.anchorX;
var offsetX = gameObject.width * gameObject.originX;
gameObject.x = (x + offsetX) - (gameObject.width * 0.5);

View file

@ -12,7 +12,7 @@
var SetCenterY = function (gameObject, y)
{
var offsetY = gameObject.height * gameObject.anchorY;
var offsetY = gameObject.height * gameObject.originY;
gameObject.y = (y + offsetY) - (gameObject.height * 0.5);

View file

@ -7,7 +7,7 @@
var SetLeft = function (gameObject, value)
{
gameObject.x = value + (gameObject.width * gameObject.anchorX);
gameObject.x = value + (gameObject.width * gameObject.originX);
return gameObject;
};

View file

@ -7,7 +7,7 @@
var SetRight = function (gameObject, value)
{
gameObject.x = (value - gameObject.width) + (gameObject.width * gameObject.anchorX);
gameObject.x = (value - gameObject.width) + (gameObject.width * gameObject.originX);
return gameObject;
};

View file

@ -7,7 +7,7 @@
var SetTop = function (gameObject, value)
{
gameObject.y = value + (gameObject.height * gameObject.anchorY);
gameObject.y = value + (gameObject.height * gameObject.originY);
return gameObject;
};