|
1 | 1 | /**
|
2 | 2 | * @author Chris Andrew <[email protected]>
|
3 |
| - * @copyright 2016-2017 Chris Andrew |
| 3 | + * @copyright 2016-2018 Chris Andrew |
4 | 4 | * @license MIT
|
5 | 5 | */
|
6 | 6 |
|
@@ -54,7 +54,7 @@ Phaser.Plugin.ArcadeSlopes.prototype.constructor = Phaser.Plugin.ArcadeSlopes;
|
54 | 54 | * @constant
|
55 | 55 | * @type {string}
|
56 | 56 | */
|
57 |
| -Phaser.Plugin.ArcadeSlopes.VERSION = '0.3.0'; |
| 57 | +Phaser.Plugin.ArcadeSlopes.VERSION = '0.3.1'; |
58 | 58 |
|
59 | 59 | /**
|
60 | 60 | * The Separating Axis Theorem collision solver type.
|
@@ -130,7 +130,7 @@ Phaser.Plugin.ArcadeSlopes.prototype.destroy = function () {
|
130 | 130 |
|
131 | 131 | /**
|
132 | 132 | * @author Chris Andrew <[email protected]>
|
133 |
| - * @copyright 2016-2017 Chris Andrew |
| 133 | + * @copyright 2016-2018 Chris Andrew |
134 | 134 | * @license MIT
|
135 | 135 | */
|
136 | 136 |
|
@@ -295,6 +295,39 @@ Phaser.Plugin.ArcadeSlopes.Facade.prototype.collide = function (i, body, tile, t
|
295 | 295 | return this.solvers.sat.collide(i, body, tile, tilemapLayer, overlapOnly);
|
296 | 296 | };
|
297 | 297 |
|
| 298 | +/** |
| 299 | + * Reset all the collision properties on a physics body. |
| 300 | + * |
| 301 | + * Resets body.touching, body.blocked, body.overlap*, body.slopes.sat.response. |
| 302 | + * |
| 303 | + * Leaves wasTouching alone. |
| 304 | + * |
| 305 | + * @method Phaser.Plugin.ArcadeSlopes.Facade#resetBodyFlags |
| 306 | + * @param {Phaser.Physics.Arcade.Body} body - The physics body. |
| 307 | + */ |
| 308 | +Phaser.Plugin.ArcadeSlopes.Facade.prototype.resetCollision = function (body) { |
| 309 | + body.touching.none = true; |
| 310 | + body.touching.up = false; |
| 311 | + body.touching.down = false; |
| 312 | + body.touching.left = false; |
| 313 | + body.touching.right = false; |
| 314 | + |
| 315 | + body.blocked.none = true; |
| 316 | + body.blocked.up = false; |
| 317 | + body.blocked.down = false; |
| 318 | + body.blocked.left = false; |
| 319 | + body.blocked.right = false; |
| 320 | + |
| 321 | + body.overlapX = 0; |
| 322 | + body.overlapY = 0; |
| 323 | + |
| 324 | + if (!body.slopes) { |
| 325 | + return; |
| 326 | + } |
| 327 | + |
| 328 | + body.slopes.sat.response = null; |
| 329 | +}; |
| 330 | + |
298 | 331 | /**
|
299 | 332 | * Whether to prefer Y axis separation in an attempt to prevent physics bodies
|
300 | 333 | * from sliding down slopes when they are separated.
|
@@ -333,7 +366,7 @@ Object.defineProperty(Phaser.Plugin.ArcadeSlopes.Facade.prototype, 'heuristics',
|
333 | 366 |
|
334 | 367 | /**
|
335 | 368 | * @author Chris Andrew <[email protected]>
|
336 |
| - * @copyright 2016-2017 Chris Andrew |
| 369 | + * @copyright 2016-2018 Chris Andrew |
337 | 370 | * @license MIT
|
338 | 371 | */
|
339 | 372 |
|
@@ -788,7 +821,7 @@ Phaser.Plugin.ArcadeSlopes.Overrides.renderDebug = function () {
|
788 | 821 |
|
789 | 822 | /**
|
790 | 823 | * @author Chris Andrew <[email protected]>
|
791 |
| - * @copyright 2016-2017 Chris Andrew |
| 824 | + * @copyright 2016-2018 Chris Andrew |
792 | 825 | * @license MIT
|
793 | 826 | */
|
794 | 827 |
|
@@ -1589,7 +1622,7 @@ Phaser.Plugin.ArcadeSlopes.SatSolver.prototype.debug = function (position, respo
|
1589 | 1622 |
|
1590 | 1623 | /**
|
1591 | 1624 | * @author Chris Andrew <[email protected]>
|
1592 |
| - * @copyright 2016-2017 Chris Andrew |
| 1625 | + * @copyright 2016-2018 Chris Andrew |
1593 | 1626 | * @license MIT
|
1594 | 1627 | */
|
1595 | 1628 |
|
@@ -2110,7 +2143,7 @@ Phaser.Plugin.ArcadeSlopes.TileSlope.QUARTER_TOP_RIGHT_HIGH = 20;
|
2110 | 2143 |
|
2111 | 2144 | /**
|
2112 | 2145 | * @author Chris Andrew <[email protected]>
|
2113 |
| - * @copyright 2016-2017 Chris Andrew |
| 2146 | + * @copyright 2016-2018 Chris Andrew |
2114 | 2147 | * @license MIT
|
2115 | 2148 | */
|
2116 | 2149 |
|
|
0 commit comments