import pygame # Window WINDOW_WIDTH = 800 WINDOW_HEIGHT = 600 UI_TOP_HEIGHT = 40 UI_BOTTOM_HEIGHT = 60 GAME_HEIGHT = WINDOW_HEIGHT - UI_TOP_HEIGHT - UI_BOTTOM_HEIGHT FPS = 60 # Grid CELL_SIZE = 40 GRID_COLS = WINDOW_WIDTH // CELL_SIZE GRID_ROWS = GAME_HEIGHT // CELL_SIZE # Colors COLOR_BG = (34, 40, 49) COLOR_GRASS = (44, 62, 44) COLOR_PATH = (139, 119, 101) COLOR_GRID_LINE = (50, 58, 50) COLOR_WHITE = (255, 255, 255) COLOR_BLACK = (0, 0, 0) COLOR_RED = (220, 50, 50) COLOR_DARK_RED = (160, 30, 30) COLOR_GREEN = (50, 200, 50) COLOR_BLUE = (70, 130, 230) COLOR_YELLOW = (230, 200, 50) COLOR_PURPLE = (150, 50, 200) COLOR_ORANGE = (230, 150, 50) COLOR_CYAN = (50, 200, 200) COLOR_GRAY = (120, 120, 120) COLOR_DARK_GRAY = (60, 60, 60) COLOR_GOLD = (255, 215, 0) COLOR_HIGHLIGHT = (255, 255, 255, 80) COLOR_DARK_BLUE = (30, 60, 150) COLOR_DARK_GREEN = (30, 130, 50) COLOR_BRIGHT_PURPLE = (180, 80, 255) COLOR_BRIGHT_GREEN = (100, 255, 100) COLOR_SILVER = (192, 192, 210) COLOR_PINK = (255, 130, 170) COLOR_LIGHT_BLUE = (100, 150, 255, 40) # Game params INITIAL_GOLD = 200 INITIAL_LIVES = 10 TOTAL_WAVES = 10 # Tower stats TOWER_DATA = { "arrow": {"damage": 20, "range": 120, "fire_rate": 0.5, "price": 50, "color": COLOR_BLUE, "name": "箭塔"}, "cannon": {"damage": 80, "range": 100, "fire_rate": 1.5, "price": 100, "color": COLOR_ORANGE, "name": "炮塔", "splash": 60}, "slow": {"damage": 5, "range": 130, "fire_rate": 0.8, "price": 75, "color": COLOR_CYAN, "name": "减速塔", "slow_factor": 0.5, "slow_duration": 2.0}, "sniper": {"damage": 120, "range": 200, "fire_rate": 2.0, "price": 120, "color": COLOR_DARK_BLUE, "name": "狙击塔"}, "poison": {"damage": 5, "range": 110, "fire_rate": 1.2, "price": 80, "color": COLOR_DARK_GREEN, "name": "毒塔", "poison_dps": 8, "poison_duration": 3.0}, "lightning": {"damage": 40, "range": 140, "fire_rate": 1.0, "price": 150, "color": COLOR_BRIGHT_PURPLE, "name": "雷电塔", "chain_count": 2, "chain_range": 80, "chain_decay": 0.5}, } # Enemy stats ENEMY_DATA = { "normal": {"hp": 100, "speed": 2, "reward": 10, "color": COLOR_RED, "size": 12, "name": "普通兵"}, "fast": {"hp": 60, "speed": 4, "reward": 8, "color": COLOR_YELLOW, "size": 10, "name": "快速兵"}, "heavy": {"hp": 300, "speed": 1, "reward": 25, "color": COLOR_PURPLE, "size": 14, "name": "重装兵"}, "boss": {"hp": 800, "speed": 0.8, "reward": 100, "color": COLOR_DARK_RED, "size": 20, "name": "BOSS"}, "swarm": {"hp": 30, "speed": 5, "reward": 3, "color": COLOR_BRIGHT_GREEN, "size": 7, "name": "虫群兵"}, "shield": {"hp": 200, "speed": 1.5, "reward": 20, "color": COLOR_SILVER, "size": 15, "name": "护盾兵", "shield_hp": 200}, "healer": {"hp": 150, "speed": 1.8, "reward": 30, "color": COLOR_PINK, "size": 12, "name": "治疗兵", "heal_range": 100, "heal_amount": 30, "heal_interval": 2.0}, } # Path waypoints (pixel coordinates) PATH_WAYPOINTS = [ (0, 180), (160, 180), (160, 340), (400, 340), (400, 100), (600, 100), (600, 340), (760, 340), (760, 220), (800, 220), ]