mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
Merge remote-tracking branch 'photonstorm/master'
This commit is contained in:
commit
1dc1dacb35
16 changed files with 212 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
### Updates
|
||||
|
||||
* Clarification of `group.exists` behavior
|
||||
* Clarification of fixedToCamera semantics
|
||||
* change Emitter.gravity from number to Phaser.Point
|
||||
* Fixed issue causing tsc to crap out under certain circumstances
|
||||
|
|
|
@ -31,6 +31,7 @@ Phaser.AnimationParser = {
|
|||
if (frameMax === undefined) { frameMax = -1; }
|
||||
if (margin === undefined) { margin = 0; }
|
||||
if (spacing === undefined) { spacing = 0; }
|
||||
if (skipFrames === undefined) { skipFrames = 0; }
|
||||
|
||||
var img = key;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
|
|||
this.alive = true;
|
||||
|
||||
/**
|
||||
* If exists is true the group is updated, otherwise it is skipped.
|
||||
* If exists is false the group will be excluded from collision checks and filters such as {@link forEachExists}. The group will not call `preUpdate` and `postUpdate` on its children and the children will not receive physics updates or camera/world boundary checks. The group will still be {@link #visible} and will still call `update` on its children.
|
||||
* @property {boolean} exists
|
||||
* @default
|
||||
*/
|
||||
|
|
9
v3/src/geom/point/Add.js
Normal file
9
v3/src/geom/point/Add.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
var Add = function (point, x, y)
|
||||
{
|
||||
point.x += x;
|
||||
point.y += y;
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
module.exports = Add;
|
8
v3/src/geom/point/Clone.js
Normal file
8
v3/src/geom/point/Clone.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
var Point = require('./Point');
|
||||
|
||||
var Clone = function (source)
|
||||
{
|
||||
return new Point(source.x, source.y);
|
||||
};
|
||||
|
||||
module.exports = Clone;
|
12
v3/src/geom/point/CopyFrom.js
Normal file
12
v3/src/geom/point/CopyFrom.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copies the x, y and diameter properties from any given object to this Circle.
|
||||
* @method Phaser.Circle#copyFrom
|
||||
* @param {any} source - The object to copy from.
|
||||
* @return {Circle} This Circle object.
|
||||
*/
|
||||
var CopyFrom = function (source, dest)
|
||||
{
|
||||
return dest.setTo(source.x, source.y);
|
||||
};
|
||||
|
||||
module.exports = CopyFrom;
|
9
v3/src/geom/point/Divide.js
Normal file
9
v3/src/geom/point/Divide.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
var Divide = function (point, x, y)
|
||||
{
|
||||
point.x /= x;
|
||||
point.y /= y;
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
module.exports = Divide;
|
6
v3/src/geom/point/Equals.js
Normal file
6
v3/src/geom/point/Equals.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
var Equals = function (point, toCompare)
|
||||
{
|
||||
return (point.x === toCompare.x && point.y === toCompare.y);
|
||||
};
|
||||
|
||||
module.exports = Equals;
|
6
v3/src/geom/point/GetMagnitude.js
Normal file
6
v3/src/geom/point/GetMagnitude.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
var GetMagnitude = function (point)
|
||||
{
|
||||
return Math.sqrt((point.x * point.x) + (point.y * point.y));
|
||||
};
|
||||
|
||||
module.exports = GetMagnitude;
|
6
v3/src/geom/point/GetMagnitudeSq.js
Normal file
6
v3/src/geom/point/GetMagnitudeSq.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
var GetMagnitudeSq = function (point)
|
||||
{
|
||||
return (point.x * point.x) + (point.y * point.y);
|
||||
};
|
||||
|
||||
module.exports = GetMagnitudeSq;
|
12
v3/src/geom/point/Invert.js
Normal file
12
v3/src/geom/point/Invert.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copies the x, y and diameter properties from any given object to this Circle.
|
||||
* @method Phaser.Circle#copyFrom
|
||||
* @param {any} source - The object to copy from.
|
||||
* @return {Circle} This Circle object.
|
||||
*/
|
||||
var Invert = function (point)
|
||||
{
|
||||
return point.setTo(point.y, point.x);
|
||||
};
|
||||
|
||||
module.exports = Invert;
|
9
v3/src/geom/point/Multiply.js
Normal file
9
v3/src/geom/point/Multiply.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
var Multiply = function (point, x, y)
|
||||
{
|
||||
point.x *= x;
|
||||
point.y *= y;
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
module.exports = Multiply;
|
16
v3/src/geom/point/Normalize.js
Normal file
16
v3/src/geom/point/Normalize.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
var GetMagnitude = require('./GetMagnitude');
|
||||
|
||||
var Normalize = function (point)
|
||||
{
|
||||
if (point.x !== 0 && point.y !== 0)
|
||||
{
|
||||
var m = GetMagnitude(point);
|
||||
|
||||
point.x /= m;
|
||||
point.y /= m;
|
||||
}
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
module.exports = Normalize;
|
96
v3/src/geom/point/Point.js
Normal file
96
v3/src/geom/point/Point.js
Normal file
|
@ -0,0 +1,96 @@
|
|||
var Point = function (x, y)
|
||||
{
|
||||
if (x === undefined) { x = 0; }
|
||||
if (y === undefined) { y = 0; }
|
||||
|
||||
this.x = x;
|
||||
|
||||
this.y = y;
|
||||
};
|
||||
|
||||
Point.prototype.constructor = Point;
|
||||
|
||||
Point.prototype = {
|
||||
|
||||
setTo: function (x, y)
|
||||
{
|
||||
if (x === undefined) { x = 0; }
|
||||
if (y === undefined) { y = x; }
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Object.defineProperties(Point.prototype, {
|
||||
|
||||
left: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.x;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.x = value;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
right: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.x;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.x = value;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
top: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.y;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.y = value;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
bottom: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return this.y;
|
||||
},
|
||||
|
||||
set: function (value)
|
||||
{
|
||||
this.y = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = Point;
|
11
v3/src/geom/point/SetMagnitude.js
Normal file
11
v3/src/geom/point/SetMagnitude.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var Normalize = require('./Normalize');
|
||||
var Multiply = require('./Multiply');
|
||||
|
||||
var SetMagnitude = function (point, magnitude)
|
||||
{
|
||||
Normalize(point);
|
||||
|
||||
return Multiply(point, magnitude, magnitude);
|
||||
};
|
||||
|
||||
module.exports = SetMagnitude;
|
9
v3/src/geom/point/Subtract.js
Normal file
9
v3/src/geom/point/Subtract.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
var Subtract = function (point, x, y)
|
||||
{
|
||||
point.x -= x;
|
||||
point.y -= y;
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
module.exports = Subtract;
|
Loading…
Reference in a new issue