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)

View file

@ -15,7 +15,9 @@ pygame.init()
# logo_img = pygame.image.load("images/logo.png")
# pygame.display.set_icon(logo_img)
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Water Bottle Shooter")
pygame.display.set_caption("Wasser der Regierung")
logo_img = pygame.image.load("images/Wasser_der_Regierung.PNG")
pygame.display.set_icon(logo_img)
def load_map(path):
try:
@ -51,6 +53,23 @@ def draw_minimap(win, map_surface, player, enemies, bottles):
for bottle in bottles:
pygame.draw.circle(win, (0, 180, 255), map2mini(bottle.x, bottle.y), 3)
def show_win_screen(win):
win.fill((40, 180, 80))
font = pygame.font.SysFont(None, 72)
text = font.render("Gewonnen!", True, (255, 255, 255))
win.blit(text, (win.get_width() // 2 - text.get_width() // 2, win.get_height() // 2 - text.get_height() // 2))
pygame.display.update()
pygame.time.wait(5000)
def show_lose_screen(win):
win.fill((180, 40, 40))
font = pygame.font.SysFont(None, 72)
text = font.render("Verloren!", True, (255, 255, 255))
win.blit(text, (win.get_width() // 2 - text.get_width() // 2, win.get_height() // 2 - text.get_height() // 2))
pygame.display.update()
pygame.time.wait(5000)
def main():
from settings import PLAYER_IMG_PATH, ENEMY_IMG_PATH, HUMAN_IMG_PATH, PLAYER_SIZE, load_img
player_img = load_img(PLAYER_IMG_PATH, (PLAYER_SIZE, PLAYER_SIZE))
@ -99,13 +118,12 @@ def main():
if minimap_visible:
draw_minimap(WIN, map_surface, player, enemies, bottles)
pygame.display.update()
# Remove win/lose condition checks
# if not player.alive:
# show_lose_screen(WIN)
# running = False
# elif all(not e.alive or e.health <= 0 for e in enemies):
# show_win_screen(WIN)
# running = False
if not player.alive:
show_lose_screen(WIN)
running = False
elif all(not e.alive or e.health <= 0 for e in enemies):
show_win_screen(WIN)
running = False
pygame.quit()
sys.exit()