This commit is contained in:
Aron Petau 2025-10-12 10:39:47 +02:00
parent 99c95b6325
commit 1b34b64d88
2 changed files with 29 additions and 11 deletions

View file

@ -24,11 +24,11 @@ class Enemy:
if self.dir == "up":
dy -= PLAYER_SPEED // 1.5
if self.dir == "down":
dy += PLAYER_SPEED // 2
dy += PLAYER_SPEED // 1.5
if self.dir == "left":
dx -= PLAYER_SPEED // 2
dx -= PLAYER_SPEED // 1.5
if self.dir == "right":
dx += PLAYER_SPEED // 2
dx += PLAYER_SPEED // 1.5
self.x = max(0, min(map_w - PLAYER_SIZE // 2, self.x + dx))
self.y = max(0, min(map_h - PLAYER_SIZE // 2, self.y + dy))
self.rect.topleft = (self.x, self.y)