New lineIntersectLine() function working nicely.

This commit is contained in:
photonstorm
2014-01-28 17:13:07 +00:00
parent 82cb66f47b
commit 5b85c910cb
8 changed files with 555 additions and 26 deletions
+2 -2
View File
@@ -1063,8 +1063,8 @@ Phaser.Physics.Arcade.prototype = {
body.x += body.overlapX;
body.y += body.overlapY;
body.setBlockFlag(body.blocked.left, body.blocked.right, body.blocked.up, body.blocked.down, body.overlapX, body.overlapY);
body.reboundCheck(true, true, true);
// body.setBlockFlag(body.blocked.left, body.blocked.right, body.blocked.up, body.blocked.down, body.overlapX, body.overlapY);
// body.reboundCheck(true, true, true);
return true;
+26 -21
View File
@@ -441,26 +441,31 @@ Phaser.Physics.Arcade.Body.prototype = {
this.updateBounds();
if (this.blocked.left && this.blockFlags[0] !== this.left)
{
this.blocked.left = false;
}
// if (this.blocked.left && this.blockFlags[0] !== this.left)
// {
// this.blocked.left = false;
// }
if (this.blocked.right && this.blockFlags[1] !== this.right)
{
this.blocked.right = false;
}
// if (this.blocked.right && this.blockFlags[1] !== this.right)
// {
// this.blocked.right = false;
// }
if (this.blocked.up && this.blockFlags[2] !== this.top)
{
this.blocked.up = false;
}
// if (this.blocked.up && this.blockFlags[2] !== this.top)
// {
// this.blocked.up = false;
// }
if (this.blocked.down && this.blockFlags[3] !== this.bottom)
{
console.log('reset down block flag', this.blockFlags[3], this.bottom);
this.blocked.down = false;
}
// if (this.blocked.down && this.blockFlags[3] !== this.bottom)
// {
// console.log('reset down block flag', this.blockFlags[3], this.bottom);
// this.blocked.down = false;
// }
this.blocked.left = false;
this.blocked.right = false;
this.blocked.up = false;
this.blocked.down = false;
this.touching.none = true;
this.touching.up = false;
@@ -485,25 +490,25 @@ Phaser.Physics.Arcade.Body.prototype = {
if (left)
{
this.blockFlags[0] = this.left + x;
console.log('left flag set to', this.blockFlags[0]);
// console.log('left flag set to', this.blockFlags[0]);
}
else if (right)
{
this.blockFlags[1] = this.right + y;
console.log('right flag set to', this.blockFlags[1]);
// console.log('right flag set to', this.blockFlags[1]);
}
if (up)
{
this.blockFlags[2] = this.top + y;
// this.blockFlags[2] = this.top;
console.log('up flag set to', this.blockFlags[2]);
// console.log('up flag set to', this.blockFlags[2]);
}
else if (down)
{
this.blockFlags[3] = this.bottom + y;
// this.blockFlags[3] = this.bottom;
console.log('down flag set to', this.blockFlags[3]);
// console.log('down flag set to', this.blockFlags[3]);
}
},
+5
View File
@@ -59,6 +59,11 @@ Phaser.Tile = function (layer, index, x, y, width, height) {
*/
this.properties = {};
/**
* @property {boolean} walked - Has this tile been walked / turned into a poly?
*/
this.walked = false;
/**
* @property {boolean} faceTop - Is the top of this tile an interesting edge?
*/
+7
View File
@@ -925,6 +925,10 @@ Phaser.Utils.Debug.prototype = {
this.context.arc(x, y, body.shape.r, 0, Math.PI * 2, false);
this.context.stroke();
this.context.closePath();
this.context.strokeStyle = 'rgb(0,0,255)';
this.context.strokeRect(body.left, body.top, body.width, body.height);
this.stop();
}
else
@@ -953,6 +957,9 @@ Phaser.Utils.Debug.prototype = {
this.context.fillRect(x + points[i].x - 2, y + points[i].y - 2, 5, 5);
}
this.context.strokeStyle = 'rgb(0,0,255)';
this.context.strokeRect(body.left, body.top, body.width, body.height);
this.stop();
}