Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/impact/collision-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ig.CollisionMap = ig.Map.extend({
var sy = vy / steps;

for( var i = 0; i < steps && (sx || sy); i++ ) {
this._traceStep( res, x, y, sx, sy, objectWidth, objectHeight, vx, vy, i );
this._traceStep( res, x, y, sx, sy, objectWidth, objectHeight, i );

x = res.pos.x;
y = res.pos.y;
Expand All @@ -53,14 +53,14 @@ ig.CollisionMap = ig.Map.extend({

// Just one step
else {
this._traceStep( res, x, y, vx, vy, objectWidth, objectHeight, vx, vy, 0 );
this._traceStep( res, x, y, vx, vy, objectWidth, objectHeight, 0 );
}

return res;
},


_traceStep: function( res, x, y, vx, vy, width, height, rvx, rvy, step ) {
_traceStep: function( res, x, y, vx, vy, width, height, step ) {

res.pos.x += vx;
res.pos.y += vy;
Expand Down Expand Up @@ -92,7 +92,7 @@ ig.CollisionMap = ig.Map.extend({
t = this.data[tileY][prevTileX];
if(
t > 1 && t <= this.lastSlope &&
this._checkTileDef(res, t, x, y, rvx, rvy, width, height, prevTileX, tileY)
this._checkTileDef(res, t, x, y, vx, vy, width, height, prevTileX, tileY)
) {
break;
}
Expand All @@ -101,7 +101,7 @@ ig.CollisionMap = ig.Map.extend({
t = this.data[tileY][tileX];
if(
t == 1 || t > this.lastSlope || // fully solid tile?
(t > 1 && this._checkTileDef(res, t, x, y, rvx, rvy, width, height, tileX, tileY)) // slope?
(t > 1 && this._checkTileDef(res, t, x, y, vx, vy, width, height, tileX, tileY)) // slope?
) {
if( t > 1 && t <= this.lastSlope && res.collision.slope ) {
break;
Expand Down Expand Up @@ -139,15 +139,15 @@ ig.CollisionMap = ig.Map.extend({
t = this.data[prevTileY][tileX];
if(
t > 1 && t <= this.lastSlope &&
this._checkTileDef(res, t, x, y, rvx, rvy, width, height, tileX, prevTileY) ) {
this._checkTileDef(res, t, x, y, vx, vy, width, height, tileX, prevTileY) ) {
break;
}
}

t = this.data[tileY][tileX];
if(
t == 1 || t > this.lastSlope || // fully solid tile?
(t > 1 && this._checkTileDef(res, t, x, y, rvx, rvy, width, height, tileX, tileY)) // slope?
(t > 1 && this._checkTileDef(res, t, x, y, vx, vy, width, height, tileX, tileY)) // slope?
) {
if( t > 1 && t <= this.lastSlope && res.collision.slope ) {
break;
Expand Down Expand Up @@ -274,4 +274,4 @@ ig.CollisionMap.staticNoCollision = { trace: function( x, y, vx, vy ) {
};
}};

});
});