Skip to content

Commit 34be82a

Browse files
committed
Added processX and processY methods
1 parent 4d484e2 commit 34be82a

1 file changed

Lines changed: 70 additions & 2 deletions

File tree

src/physics/arcade/Body.js

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,75 @@ var Body = new Class({
23162316
},
23172317

23182318
/**
2319-
* The Body's horizontal position (left edge).
2319+
* This is an internal handler, called by the `ProcessX` function as part
2320+
* of the collision step. You should almost never call this directly.
2321+
*
2322+
* @method Phaser.Physics.Arcade.Body#processX
2323+
* @since 3.50.0
2324+
*
2325+
* @param {number} x - The amount to add to the Body position.
2326+
* @param {number} [vx] - The amount to add to the Body velocity.
2327+
* @param {boolean} [left] - Set the blocked.left value?
2328+
* @param {boolean} [right] - Set the blocked.right value?
2329+
*/
2330+
processX: function (x, vx, left, right)
2331+
{
2332+
this.x += x;
2333+
2334+
if (vx !== null)
2335+
{
2336+
this.velocity.x = vx;
2337+
}
2338+
2339+
var blocked = this.blocked;
2340+
2341+
if (left)
2342+
{
2343+
blocked.left = true;
2344+
}
2345+
2346+
if (right)
2347+
{
2348+
blocked.right = true;
2349+
}
2350+
},
2351+
2352+
/**
2353+
* This is an internal handler, called by the `ProcessY` function as part
2354+
* of the collision step. You should almost never call this directly.
2355+
*
2356+
* @method Phaser.Physics.Arcade.Body#processY
2357+
* @since 3.50.0
2358+
*
2359+
* @param {number} y - The amount to add to the Body position.
2360+
* @param {number} [vy] - The amount to add to the Body velocity.
2361+
* @param {boolean} [up] - Set the blocked.up value?
2362+
* @param {boolean} [down] - Set the blocked.down value?
2363+
*/
2364+
processY: function (y, vy, up, down)
2365+
{
2366+
this.y += y;
2367+
2368+
if (vy !== null)
2369+
{
2370+
this.velocity.y = vy;
2371+
}
2372+
2373+
var blocked = this.blocked;
2374+
2375+
if (up)
2376+
{
2377+
blocked.up = true;
2378+
}
2379+
2380+
if (down)
2381+
{
2382+
blocked.down = true;
2383+
}
2384+
},
2385+
2386+
/**
2387+
* The Bodys horizontal position (left edge).
23202388
*
23212389
* @name Phaser.Physics.Arcade.Body#x
23222390
* @type {number}
@@ -2337,7 +2405,7 @@ var Body = new Class({
23372405
},
23382406

23392407
/**
2340-
* The Body's vertical position (top edge).
2408+
* The Bodys vertical position (top edge).
23412409
*
23422410
* @name Phaser.Physics.Arcade.Body#y
23432411
* @type {number}

0 commit comments

Comments
 (0)