Skip to content

Commit

Permalink
Merge pull request #57 from maggie-j-liu/patch-1
Browse files Browse the repository at this point in the history
fix collision issue
  • Loading branch information
leomcelroy authored Feb 9, 2022
2 parents 8eda756 + e5d757b commit 5937208
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Object {
}
}

if (x >= 0 && y >= 0 && this._collides !== null)
if (ogx >= 0 && ogy >= 0 && this._collides !== null)
this._collides(this, otherObj);
});

Expand Down Expand Up @@ -226,13 +226,14 @@ class Object {
ctx.fillRect(-2, -2, 4, 4);
}

if (this._update !== null) this._update(obj);
ctx.restore();

if (Engine.show.hitbox) {
ctx.strokeStyle = "grey";
ctx.strokeRect(this.x - ox, this.y - oy, w, h);
}

if (this._update !== null) this._update(obj);
}

set x(val) {
Expand Down

0 comments on commit 5937208

Please sign in to comment.