mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Fixed all the bounds methods to use origin instead of anchor.
This commit is contained in:
parent
91f3861ad7
commit
6d6af08cae
14 changed files with 18 additions and 18 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue