Compare commits

..

No commits in common. "65c5ce0f5591457d909a692dfb7ed146d96cb7c5" and "7970679e03a9ef5178a892e11ca5fb3717e420fb" have entirely different histories.

3 changed files with 5 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Before After
Before After

View file

@ -35,16 +35,16 @@ class Enemy:
elif self.controlled: elif self.controlled:
dx = dy = 0 dx = dy = 0
if keys[pygame.K_UP]: if keys[pygame.K_UP]:
dy -= PLAYER_SPEED dy -= PLAYER_SPEED // 1.5
self.dir = "up" self.dir = "up"
if keys[pygame.K_DOWN]: if keys[pygame.K_DOWN]:
dy += PLAYER_SPEED dy += PLAYER_SPEED // 1.5
self.dir = "down" self.dir = "down"
if keys[pygame.K_LEFT]: if keys[pygame.K_LEFT]:
dx -= PLAYER_SPEED dx -= PLAYER_SPEED // 1.5
self.dir = "left" self.dir = "left"
if keys[pygame.K_RIGHT]: if keys[pygame.K_RIGHT]:
dx += PLAYER_SPEED dx += PLAYER_SPEED // 1.5
self.dir = "right" self.dir = "right"
self.x = max(0, min(map_w - PLAYER_SIZE // 2, self.x + dx)) 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.y = max(0, min(map_h - PLAYER_SIZE // 2, self.y + dy))
@ -54,7 +54,7 @@ class Enemy:
dx = player.x - self.x dx = player.x - self.x
dy = player.y - self.y dy = player.y - self.y
dist = max(1, (dx ** 2 + dy ** 2) ** 0.5) dist = max(1, (dx ** 2 + dy ** 2) ** 0.5)
speed = PLAYER_SPEED // 1.5 speed = PLAYER_SPEED // 2
self.x += int(speed * dx / dist) self.x += int(speed * dx / dist)
self.y += int(speed * dy / dist) self.y += int(speed * dy / dist)
self.x = max(0, min(map_w - PLAYER_SIZE // 2, self.x)) self.x = max(0, min(map_w - PLAYER_SIZE // 2, self.x))

Binary file not shown.