logo
This commit is contained in:
parent
99c95b6325
commit
1b34b64d88
2 changed files with 29 additions and 11 deletions
6
enemy.py
6
enemy.py
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue