Skip to content

Commit 5937208

Browse files
authored
Merge pull request #57 from maggie-j-liu/patch-1
fix collision issue
2 parents 8eda756 + e5d757b commit 5937208

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Engine.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class Object {
185185
}
186186
}
187187

188-
if (x >= 0 && y >= 0 && this._collides !== null)
188+
if (ogx >= 0 && ogy >= 0 && this._collides !== null)
189189
this._collides(this, otherObj);
190190
});
191191

@@ -226,13 +226,14 @@ class Object {
226226
ctx.fillRect(-2, -2, 4, 4);
227227
}
228228

229-
if (this._update !== null) this._update(obj);
230229
ctx.restore();
231230

232231
if (Engine.show.hitbox) {
233232
ctx.strokeStyle = "grey";
234233
ctx.strokeRect(this.x - ox, this.y - oy, w, h);
235234
}
235+
236+
if (this._update !== null) this._update(obj);
236237
}
237238

238239
set x(val) {

0 commit comments

Comments
 (0)