游戏可以运行

This commit is contained in:
2026-05-20 21:23:46 +08:00
parent e5aa78e8be
commit 804f9d87aa
7 changed files with 256 additions and 49 deletions

View File

@@ -4,7 +4,7 @@ from game.config import (
WINDOW_WIDTH, WINDOW_HEIGHT, UI_TOP_HEIGHT, UI_BOTTOM_HEIGHT,
CELL_SIZE, COLOR_BLACK, COLOR_WHITE, COLOR_GOLD, COLOR_RED,
COLOR_GREEN, COLOR_DARK_GRAY, COLOR_GRAY, COLOR_BG,
TOWER_DATA, INITIAL_LIVES, TOTAL_WAVES, COLOR_LIGHT_BLUE,
TOWER_DATA, COLOR_LIGHT_BLUE,
)
@@ -43,7 +43,7 @@ class UI:
return None
return self.selected_tower
def draw(self, surface, gold, lives, wave_num, wave_active, has_more, font, small_font):
def draw(self, surface, gold, lives, wave_num, wave_active, has_more, font, small_font, total_waves=10):
# Top bar
pygame.draw.rect(surface, COLOR_DARK_GRAY, (0, 0, WINDOW_WIDTH, UI_TOP_HEIGHT))
@@ -53,7 +53,7 @@ class UI:
lives_text = font.render(f"生命: {lives}", True, COLOR_RED if lives <= 3 else COLOR_GREEN)
surface.blit(lives_text, (160, 10))
wave_text = font.render(f"波次: {wave_num}/{TOTAL_WAVES}", True, COLOR_WHITE)
wave_text = font.render(f"波次: {wave_num}/{total_waves}", True, COLOR_WHITE)
surface.blit(wave_text, (310, 10))
# Slow-time indicator