summaryrefslogtreecommitdiffstats
path: root/src/controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller')
-rw-r--r--src/controller/gamecontext.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/controller/gamecontext.ts b/src/controller/gamecontext.ts
index 38a08ed..b69b306 100644
--- a/src/controller/gamecontext.ts
+++ b/src/controller/gamecontext.ts
@@ -114,14 +114,12 @@ export class GameContext {
const dest = vec2.scaleAndAdd(vec2.create(), this.entityPos, this.entityMovement, this.speed);
const newDest = vec2.create();
- while (true) {
- if (vec2.equals(dest, this.entityPos))
+ while (this.updateStepCollide(newDest, dest)) {
+ if (vec2.equals(newDest, this.entityPos))
return;
- if (!this.updateStepCollide(newDest, dest))
- break;
-
vec2.copy(dest, newDest);
+
}
vec2.copy(this.entityPos, dest);