mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Updated documentation.
This commit is contained in:
+250
-47
@@ -54,6 +54,10 @@
|
||||
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
@@ -138,6 +142,10 @@
|
||||
<a href="Phaser.Events.html">Events</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Filter.html">Filter</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Frame.html">Frame</a>
|
||||
</li>
|
||||
@@ -302,6 +310,26 @@
|
||||
<a href="Phaser.Text.html">Text</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tile.html">Tile</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tileset.html">Tileset</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||
</li>
|
||||
@@ -310,6 +338,10 @@
|
||||
<a href="Phaser.Time.html">Time</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Timer.html">Timer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Touch.html">Touch</a>
|
||||
</li>
|
||||
@@ -356,6 +388,14 @@
|
||||
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#render">render</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#renderXY">renderXY</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#right">right</a>
|
||||
</li>
|
||||
@@ -410,7 +450,7 @@ Phaser.Physics.Arcade = function (game) {
|
||||
/**
|
||||
* @property {Phaser.Point} gravity - The World gravity setting. Defaults to x: 0, y: 0, or no gravity.
|
||||
*/
|
||||
this.gravity = new Phaser.Point;
|
||||
this.gravity = new Phaser.Point();
|
||||
|
||||
/**
|
||||
* @property {Phaser.Rectangle} bounds - The bounds inside of which the physics world exists. Defaults to match the world bounds.
|
||||
@@ -448,13 +488,13 @@ Phaser.Physics.Arcade = function (game) {
|
||||
* @property {Phaser.Rectangle} _bounds1 - Internal cache var.
|
||||
* @private
|
||||
*/
|
||||
this._bounds1 = new Phaser.Rectangle;
|
||||
this._bounds1 = new Phaser.Rectangle();
|
||||
|
||||
/**
|
||||
* @property {Phaser.Rectangle} _bounds2 - Internal cache var.
|
||||
* @private
|
||||
*/
|
||||
this._bounds2 = new Phaser.Rectangle;
|
||||
this._bounds2 = new Phaser.Rectangle();
|
||||
|
||||
/**
|
||||
* @property {number} _overlap - Internal cache var.
|
||||
@@ -665,37 +705,194 @@ Phaser.Physics.Arcade.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if two Sprite objects overlap.
|
||||
* Checks for overlaps between two game objects. The objects can be Sprites, Groups or Emitters.
|
||||
* You can perform Sprite vs. Sprite, Sprite vs. Group and Group vs. Group overlap checks.
|
||||
* Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#overlap
|
||||
* @param {Phaser.Sprite} object1 - The first object to check. Can be an instance of Phaser.Sprite or anything that extends it.
|
||||
* @param {Phaser.Sprite} object2 - The second object to check. Can be an instance of Phaser.Sprite or anything that extends it.
|
||||
* @returns {boolean} true if the two objects overlap.
|
||||
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
|
||||
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
|
||||
* @param {function} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.
|
||||
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then overlapCallback will only be called if processCallback returns true.
|
||||
* @param {object} [callbackContext] - The context in which to run the callbacks.
|
||||
* @returns {boolean} True if an overlap occured otherwise false.
|
||||
*/
|
||||
overlap: function (object1, object2) {
|
||||
overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) {
|
||||
|
||||
overlapCallback = overlapCallback || null;
|
||||
processCallback = processCallback || null;
|
||||
callbackContext = callbackContext || overlapCallback;
|
||||
|
||||
this._result = false;
|
||||
this._total = 0;
|
||||
|
||||
// Only test valid objects
|
||||
if (object1 && object2 && object1.exists && object2.exists)
|
||||
{
|
||||
return (Phaser.Rectangle.intersects(object1.body, object2.body));
|
||||
// SPRITES
|
||||
if (object1.type == Phaser.SPRITE)
|
||||
{
|
||||
if (object2.type == Phaser.SPRITE)
|
||||
{
|
||||
this.overlapSpriteVsSprite(object1, object2, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
|
||||
{
|
||||
this.overlapSpriteVsGroup(object1, object2, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
}
|
||||
// GROUPS
|
||||
else if (object1.type == Phaser.GROUP)
|
||||
{
|
||||
if (object2.type == Phaser.SPRITE)
|
||||
{
|
||||
this.overlapSpriteVsGroup(object2, object1, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
|
||||
{
|
||||
this.overlapGroupVsGroup(object1, object2, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
}
|
||||
// EMITTER
|
||||
else if (object1.type == Phaser.EMITTER)
|
||||
{
|
||||
if (object2.type == Phaser.SPRITE)
|
||||
{
|
||||
this.overlapSpriteVsGroup(object2, object1, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
|
||||
{
|
||||
this.overlapGroupVsGroup(object1, object2, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return (this._total > 0);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemaps.
|
||||
* You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap or Group vs. Tilemap collisions.
|
||||
* An internal function. Use Phaser.Physics.Arcade.overlap instead.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#overlapSpriteVsSprite
|
||||
* @private
|
||||
*/
|
||||
overlapSpriteVsSprite: function (sprite1, sprite2, overlapCallback, processCallback, callbackContext) {
|
||||
|
||||
this._result = Phaser.Rectangle.intersects(sprite1.body, sprite2.body);
|
||||
|
||||
if (this._result)
|
||||
{
|
||||
// They collided, is there a custom process callback?
|
||||
if (processCallback)
|
||||
{
|
||||
if (processCallback.call(callbackContext, sprite1, sprite2))
|
||||
{
|
||||
this._total++;
|
||||
|
||||
if (overlapCallback)
|
||||
{
|
||||
overlapCallback.call(callbackContext, sprite1, sprite2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._total++;
|
||||
|
||||
if (overlapCallback)
|
||||
{
|
||||
overlapCallback.call(callbackContext, sprite1, sprite2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* An internal function. Use Phaser.Physics.Arcade.overlap instead.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#overlapSpriteVsGroup
|
||||
* @private
|
||||
*/
|
||||
overlapSpriteVsGroup: function (sprite, group, overlapCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// What is the sprite colliding with in the quadtree?
|
||||
this._potentials = this.quadTree.retrieve(sprite);
|
||||
|
||||
for (var i = 0, len = this._potentials.length; i < len; i++)
|
||||
{
|
||||
// We have our potential suspects, are they in this group?
|
||||
if (this._potentials[i].sprite.group == group)
|
||||
{
|
||||
this._result = Phaser.Rectangle.intersects(sprite.body, this._potentials[i]);
|
||||
|
||||
if (this._result && processCallback)
|
||||
{
|
||||
this._result = processCallback.call(callbackContext, sprite, this._potentials[i].sprite);
|
||||
}
|
||||
|
||||
if (this._result)
|
||||
{
|
||||
this._total++;
|
||||
|
||||
if (overlapCallback)
|
||||
{
|
||||
overlapCallback.call(callbackContext, sprite, this._potentials[i].sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* An internal function. Use Phaser.Physics.Arcade.overlap instead.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#overlapGroupVsGroup
|
||||
* @private
|
||||
*/
|
||||
overlapGroupVsGroup: function (group1, group2, overlapCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group1.length === 0 || group2.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (group1._container.first._iNext)
|
||||
{
|
||||
var currentNode = group1._container.first._iNext;
|
||||
|
||||
do
|
||||
{
|
||||
if (currentNode.exists)
|
||||
{
|
||||
this.overlapSpriteVsGroup(currentNode, group2, overlapCallback, processCallback, callbackContext);
|
||||
}
|
||||
currentNode = currentNode._iNext;
|
||||
}
|
||||
while (currentNode != group1._container.last._iNext);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemap Layers.
|
||||
* You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
|
||||
* The objects are also automatically separated.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade#collide
|
||||
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap
|
||||
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap
|
||||
* @param {function} [collideCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you passed them to Collision.overlap.
|
||||
* @param {function} [collideCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.
|
||||
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collideCallback will only be called if processCallback returns true.
|
||||
* @param {object} [callbackContext] - The context in which to run the callbacks.
|
||||
* @returns {number} The number of collisions that were processed.
|
||||
* @returns {boolean} True if a collision occured otherwise false.
|
||||
*/
|
||||
collide: function (object1, object2, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
@@ -787,7 +984,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
this._mapData = tilemapLayer.getTiles(sprite.body.x, sprite.body.y, sprite.body.width, sprite.body.height, true);
|
||||
|
||||
if (this._mapData.length == 0)
|
||||
if (this._mapData.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -831,12 +1028,12 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group.length == 0)
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (group.length == 0)
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -845,7 +1042,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
var currentNode = group._container.first._iNext;
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
if (currentNode.exists)
|
||||
{
|
||||
@@ -904,7 +1101,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group.length == 0)
|
||||
if (group.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -946,7 +1143,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
*/
|
||||
collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext) {
|
||||
|
||||
if (group1.length == 0 || group2.length == 0)
|
||||
if (group1.length === 0 || group2.length === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -955,7 +1152,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
var currentNode = group1._container.first._iNext;
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
if (currentNode.exists)
|
||||
{
|
||||
@@ -1003,7 +1200,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
this._maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + this.OVERLAP_BIAS;
|
||||
|
||||
if (body1.deltaX() == 0 && body2.deltaX() == 0)
|
||||
if (body1.deltaX() === 0 && body2.deltaX() === 0)
|
||||
{
|
||||
// They overlap but neither of them are moving
|
||||
body1.embedded = true;
|
||||
@@ -1014,7 +1211,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving right and/or Body2 is moving left
|
||||
this._overlap = body1.x + body1.width - body2.x;
|
||||
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.right == false || body2.allowCollision.left == false)
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.right === false || body2.allowCollision.left === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1029,7 +1226,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving left and/or Body2 is moving right
|
||||
this._overlap = body1.x - body2.width - body2.x;
|
||||
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.left == false || body2.allowCollision.right == false)
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.left === false || body2.allowCollision.right === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1041,7 +1238,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
}
|
||||
|
||||
// Then adjust their positions and velocities accordingly (if there was any overlap)
|
||||
if (this._overlap != 0)
|
||||
if (this._overlap !== 0)
|
||||
{
|
||||
body1.overlapX = this._overlap;
|
||||
body2.overlapX = this._overlap;
|
||||
@@ -1080,6 +1277,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body2.x += this._overlap;
|
||||
body2.velocity.x = this._velocity1 - this._velocity2 * body2.bounce.x;
|
||||
}
|
||||
body1.updateHulls();
|
||||
body2.updateHulls();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1111,7 +1310,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
{
|
||||
this._maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + this.OVERLAP_BIAS;
|
||||
|
||||
if (body1.deltaY() == 0 && body2.deltaY() == 0)
|
||||
if (body1.deltaY() === 0 && body2.deltaY() === 0)
|
||||
{
|
||||
// They overlap but neither of them are moving
|
||||
body1.embedded = true;
|
||||
@@ -1122,7 +1321,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving down and/or Body2 is moving up
|
||||
this._overlap = body1.y + body1.height - body2.y;
|
||||
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.down == false || body2.allowCollision.up == false)
|
||||
if ((this._overlap > this._maxOverlap) || body1.allowCollision.down === false || body2.allowCollision.up === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1137,7 +1336,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Body1 is moving up and/or Body2 is moving down
|
||||
this._overlap = body1.y - body2.height - body2.y;
|
||||
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.up == false || body2.allowCollision.down == false)
|
||||
if ((-this._overlap > this._maxOverlap) || body1.allowCollision.up === false || body2.allowCollision.down === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1149,7 +1348,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
}
|
||||
|
||||
// Then adjust their positions and velocities accordingly (if there was any overlap)
|
||||
if (this._overlap != 0)
|
||||
if (this._overlap !== 0)
|
||||
{
|
||||
body1.overlapY = this._overlap;
|
||||
body2.overlapY = this._overlap;
|
||||
@@ -1200,6 +1399,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body2.x += body1.x - body1.lastX;
|
||||
}
|
||||
}
|
||||
body1.updateHulls();
|
||||
body2.updateHulls();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1221,6 +1422,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
this._result = (this.separateTileX(body, tile, true) || this.separateTileY(body, tile, true));
|
||||
|
||||
return this._result;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1233,7 +1436,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
separateTileX: function (body, tile, separate) {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (body.immovable || body.deltaX() == 0 || Phaser.Rectangle.intersects(body.hullX, tile) == false)
|
||||
if (body.immovable || body.deltaX() === 0 || Phaser.Rectangle.intersects(body.hullX, tile) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1248,8 +1451,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving left
|
||||
this._overlap = tile.right - body.hullX.x;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.left == false || tile.tile.collideRight == false)
|
||||
if (body.allowCollision.left == false || tile.tile.collideRight == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.left === false || tile.tile.collideRight === false)
|
||||
if (body.allowCollision.left === false || tile.tile.collideRight === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1263,8 +1466,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving right
|
||||
this._overlap = body.hullX.right - tile.x;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.right == false || tile.tile.collideLeft == false)
|
||||
if (body.allowCollision.right == false || tile.tile.collideLeft == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.right === false || tile.tile.collideLeft === false)
|
||||
if (body.allowCollision.right === false || tile.tile.collideLeft === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1275,7 +1478,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
}
|
||||
|
||||
// Then adjust their positions and velocities accordingly (if there was any overlap)
|
||||
if (this._overlap != 0)
|
||||
if (this._overlap !== 0)
|
||||
{
|
||||
if (separate)
|
||||
{
|
||||
@@ -1288,7 +1491,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.x = body.x - this._overlap;
|
||||
}
|
||||
|
||||
if (body.bounce.x == 0)
|
||||
if (body.bounce.x === 0)
|
||||
{
|
||||
body.velocity.x = 0;
|
||||
}
|
||||
@@ -1319,7 +1522,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
separateTileY: function (body, tile, separate) {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (body.immovable || body.deltaY() == 0 || Phaser.Rectangle.intersects(body.hullY, tile) == false)
|
||||
if (body.immovable || body.deltaY() === 0 || Phaser.Rectangle.intersects(body.hullY, tile) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1334,8 +1537,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving up
|
||||
this._overlap = tile.bottom - body.hullY.y;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.up == false || tile.tile.collideDown == false)
|
||||
if (body.allowCollision.up == false || tile.tile.collideDown == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.up === false || tile.tile.collideDown === false)
|
||||
if (body.allowCollision.up === false || tile.tile.collideDown === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1349,8 +1552,8 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// Moving down
|
||||
this._overlap = body.hullY.bottom - tile.y;
|
||||
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.down == false || tile.tile.collideUp == false)
|
||||
if (body.allowCollision.down == false || tile.tile.collideUp == false)
|
||||
// if ((this._overlap > this._maxOverlap) || body.allowCollision.down === false || tile.tile.collideUp === false)
|
||||
if (body.allowCollision.down === false || tile.tile.collideUp === false)
|
||||
{
|
||||
this._overlap = 0;
|
||||
}
|
||||
@@ -1361,7 +1564,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
}
|
||||
|
||||
// Then adjust their positions and velocities accordingly (if there was any overlap)
|
||||
if (this._overlap != 0)
|
||||
if (this._overlap !== 0)
|
||||
{
|
||||
if (separate)
|
||||
{
|
||||
@@ -1374,7 +1577,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
body.y = body.y - this._overlap;
|
||||
}
|
||||
|
||||
if (body.bounce.y == 0)
|
||||
if (body.bounce.y === 0)
|
||||
{
|
||||
body.velocity.y = 0;
|
||||
}
|
||||
@@ -1514,7 +1717,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
velocityFromAngle: function (angle, speed, point) {
|
||||
|
||||
if (typeof speed === 'undefined') { speed = 60; }
|
||||
point = point || new Phaser.Point;
|
||||
point = point || new Phaser.Point();
|
||||
|
||||
return point.setTo((Math.cos(this.game.math.degToRad(angle)) * speed), (Math.sin(this.game.math.degToRad(angle)) * speed));
|
||||
|
||||
@@ -1533,7 +1736,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
velocityFromRotation: function (rotation, speed, point) {
|
||||
|
||||
if (typeof speed === 'undefined') { speed = 60; }
|
||||
point = point || new Phaser.Point;
|
||||
point = point || new Phaser.Point();
|
||||
|
||||
return point.setTo((Math.cos(rotation) * speed), (Math.sin(rotation) * speed));
|
||||
|
||||
@@ -1552,7 +1755,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
accelerationFromRotation: function (rotation, speed, point) {
|
||||
|
||||
if (typeof speed === 'undefined') { speed = 60; }
|
||||
point = point || new Phaser.Point;
|
||||
point = point || new Phaser.Point();
|
||||
|
||||
return point.setTo((Math.cos(rotation) * speed), (Math.sin(rotation) * speed));
|
||||
|
||||
@@ -1781,7 +1984,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Thu Nov 07 2013 06:07:33 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user