From 3f70382c2b6b31c358498b79e53bb2eee2e44bed Mon Sep 17 00:00:00 2001 From: Srikar Narla Date: Wed, 19 Jun 2024 13:41:46 +0530 Subject: [PATCH] Minor change --- classes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes.js b/classes.js index f9bec37..f0c111c 100644 --- a/classes.js +++ b/classes.js @@ -456,9 +456,9 @@ class Zombie { this.y = this.game.height - this.height; this.vy = 0; if (!this.froze) { - if (this.x < this.game.player.x) { + if (this.x + this.width <= this.game.player.x) { this.x += this.vx; - } else { + } else if(this.x >= this.game.player.x+this.game.player.width){ this.x -= this.vx; } }