-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
273 lines (247 loc) · 8.4 KB
/
constants.py
File metadata and controls
273 lines (247 loc) · 8.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
"""
Constants for the Final Escape game.
"""
# Game window settings
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
BACKGROUND_COLOR = (0, 0, 0) # Black
FULLSCREEN = True # Flag to control fullscreen mode
# Player settings
PLAYER_SIZE = 60
PLAYER_SPEED = 300 # Pixels per second
PLAYER_MAX_HEALTH = 100
PLAYER_ACCELERATION = 1200 # Acceleration rate (pixels/second²)
PLAYER_DECELERATION = 900 # Deceleration rate (pixels/second²)
# Health bar settings
HEALTH_BAR_WIDTH = 200
HEALTH_BAR_HEIGHT = 20
HEALTH_BAR_BORDER = 2
HEALTH_BAR_COLOR = (0, 255, 0) # Green
HEALTH_BAR_BACKGROUND_COLOR = (100, 100, 100) # Gray
HEALTH_BAR_BORDER_COLOR = (255, 255, 255) # White
# Asteroid settings
ASTEROID_SIZES = {
"small": {"min": 15, "max": 25},
"medium": {"min": 26, "max": 40},
"large": {"min": 41, "max": 60}
}
ASTEROID_MIN_SPEED = 50
ASTEROID_MAX_SPEED = 200
ASTEROID_SPAWN_RATE = 0.5 # Seconds between spawns (average)
# Speed multipliers for different sizes (smaller = faster)
ASTEROID_SPEED_MULTIPLIERS = {
"small": 1.4,
"medium": 1.0,
"large": 0.7
}
# Asteroid type spawn weights (higher number = more frequent)
ASTEROID_TYPE_WEIGHTS = {
0: 25, # a0 - Very common
1: 20, # a1
2: 15, # a2
3: 10, # a3
4: 7, # a4
5: 4, # a5
6: 2 # a6 - Very rare
}
# Allowed size categories by asteroid type
ASTEROID_SIZE_RESTRICTIONS = {
0: ["small", "medium", "large"], # a0 - All sizes allowed
1: ["small", "medium", "large"], # a1 - All sizes allowed
2: ["small", "medium", "large"], # a2 - All sizes allowed
3: ["small", "medium"], # a3 - Medium and small only
4: ["small", "medium"], # a4 - Medium and small only
5: ["small"], # a5 - Small only
6: ["small"] # a6 - Small only (most dangerous)
}
# Base damage values by asteroid type (higher = more damage)
ASTEROID_BASE_DAMAGE = {
0: 5, # a0 - Minimal damage
1: 10, # a1
2: 15, # a2
3: 25, # a3
4: 35, # a4
5: 50, # a5
6: 80 # a6 - Very dangerous
}
# Damage multipliers by size (larger = more damage)
ASTEROID_SIZE_DAMAGE_MULTIPLIERS = {
"small": 1.0, # Base damage
"medium": 1.5, # 50% more damage
"large": 2.0 # Double damage
}
# Particle system settings
ASTEROID_PARTICLE_COLORS = [
(255, 165, 0), # Orange
(255, 140, 0), # Dark Orange
(255, 69, 0), # Red-Orange
(255, 215, 0), # Gold
(255, 99, 71) # Tomato
]
PLAYER_THRUSTER_COLORS = [
(0, 191, 255), # Deep Sky Blue
(30, 144, 255), # Dodger Blue
(65, 105, 225), # Royal Blue
(100, 149, 237), # Cornflower Blue
(135, 206, 250) # Light Sky Blue
]
MAX_PARTICLES = 500
PARTICLE_LIFETIME = 1.0 # Seconds before a particle disappears
# Background stars settings
NUM_STARS = 100
STAR_SIZES = [1, 2, 3] # Different star sizes
STAR_COLORS = [
(255, 255, 255), # White
(200, 200, 255), # Light Blue
(255, 255, 200), # Light Yellow
]
STAR_SPEEDS = [20, 40, 60] # Different star speeds
# Countdown timer settings
COUNTDOWN_DURATION = 3 # seconds
COUNTDOWN_FONT_SIZE = 120
COUNTDOWN_COLOR = (255, 255, 255) # White
# Scene transition settings
FADE_DURATION = 1.0 # seconds
MUSIC_FADE_DURATION = 1000 # milliseconds
# Font sizes
SCORE_FONT_SIZE = 30
GAME_OVER_FONT_SIZE = 75
TITLE_FONT_SIZE = 90
INSTRUCTION_FONT_SIZE = 25
# Score color
SCORE_COLOR = (255, 255, 255) # White
# Game state identifiers
STATE_MENU = 0
STATE_COUNTDOWN = 1
STATE_PLAYING = 2
STATE_GAME_OVER = 3
STATE_SETTINGS = 4
# File paths
PLAYER_IMAGE_PATH = "assets/images/ship.png"
LOGO_IMAGE_PATH = "assets/images/logo.png"
ASTEROID_IMAGE_PATTERN = "assets/images/asteroids/a{}.png" # Format with 0-6
MENU_MUSIC_PATH = "assets/sound/Lone Knight in the Stars(Menu Scene).ogg"
GAME_MUSIC_PATH = "assets/sound/Pixel Knight Asteroid Chase(Game Scene).ogg"
GAME_OVER_MUSIC_PATH = "assets/sound/Asteroid Knight(Game Over).ogg"
MENU_SELECT_SOUND_PATH = "assets/sound/menu_select.wav"
MENU_NAVIGATE_SOUND_PATH = "assets/sound/menu_navigate.wav"
# Difficulty settings
DIFFICULTY_LEVELS = [
"Empty Space", # Easiest
"Normal Space", # Default
"We did not agree on that",
"You kidding",
"Hell No!!!" # Hardest
]
# Difficulty spawn rate multipliers (higher = more asteroids)
DIFFICULTY_SPAWN_RATE_MULTIPLIERS = {
"Empty Space": 1.0,
"Normal Space": 2.0,
"We did not agree on that": 4.0,
"You kidding": 8.0,
"Hell No!!!": 16.0
}
# Difficulty asteroid variety impact
# Higher indices mean harder asteroids (a5, a6) will spawn more frequently
DIFFICULTY_ASTEROID_VARIETY = {
"Empty Space": {0: 40, 1: 30, 2: 20, 3: 10, 4: 0, 5: 0, 6: 0},
"Normal Space": {0: 25, 1: 20, 2: 15, 3: 10, 4: 7, 5: 4, 6: 2},
"We did not agree on that": {0: 15, 1: 15, 2: 20, 3: 20, 4: 15, 5: 10, 6: 5},
"You kidding": {0: 10, 1: 10, 2: 15, 3: 20, 4: 20, 5: 15, 6: 10},
"Hell No!!!": {0: 5, 1: 5, 2: 10, 3: 15, 4: 20, 5: 25, 6: 20}
}
# Difficulty asteroid size impact
DIFFICULTY_SIZE_RESTRICTIONS = {
"Empty Space": {
0: ["small", "medium", "large"],
1: ["small", "medium", "large"],
2: ["small", "medium", "large"],
3: ["small", "medium"],
4: ["small", "medium"],
5: ["small", "medium"],
6: ["small"]
},
"Normal Space": {
0: ["small", "medium", "large"],
1: ["small", "medium", "large"],
2: ["small", "medium", "large"],
3: ["small", "medium"],
4: ["small", "medium"],
5: ["small", "medium"],
6: ["small"]
},
"We did not agree on that": {
0: ["small", "medium", "large"],
1: ["small", "medium", "large"],
2: ["small", "medium", "large"],
3: ["small", "medium"],
4: ["small", "medium"],
5: ["small", "medium"],
6: ["small"]
},
"You kidding": {
0: ["small", "medium", "large"],
1: ["small", "medium", "large"],
2: ["small", "medium", "large"],
3: ["small", "medium"],
4: ["small", "medium"],
5: ["small", "medium"],
6: ["small"]
},
"Hell No!!!": {
0: ["small", "medium", "large"],
1: ["small", "medium", "large"],
2: ["small", "medium", "large"],
3: ["small", "medium"],
4: ["small", "medium"],
5: ["small", "medium"],
6: ["small"]
}
}
# Power-up Settings
POWERUP_SIZE = 40 # Default size for power-up icons
POWERUP_SPAWN_CHANCE = 0.25 # 25% chance to spawn (increased from 5% to improve chances)
POWERUP_BOOM_ID = "boom"
POWERUP_HEALTH_ID = "health"
POWERUP_TYPES = {
POWERUP_BOOM_ID: {
"image_file": "boom.png",
"rarity": "rare"
},
f"{POWERUP_HEALTH_ID}_25": {
"image_file": "health.png",
"rarity": "common",
"amount": 25
},
f"{POWERUP_HEALTH_ID}_50": {
"image_file": "health.png",
"rarity": "uncommon",
"amount": 50
},
f"{POWERUP_HEALTH_ID}_100": {
"image_file": "health.png",
"rarity": "rare",
"amount": 100
}
}
# New independent power-up spawning settings
POWERUP_SPAWN_INTERVAL_MIN = 2.0 # Decreased from 4.0 to 2.0 for even more frequent spawns
POWERUP_SPAWN_INTERVAL_MAX = 4.0 # Decreased from 8.0 to 4.0 for even more frequent spawns
MAX_ACTIVE_POWERUPS = 5 # Increased from 3 to 5 to allow more power-ups on screen at once
POWERUP_BOOM_EFFECT_RADIUS_FACTOR = 0.7 # Increased from 0.5 to 0.7 for larger explosion radius
POWERUP_BOOM_FLASH_COLOR = (255, 255, 255) # White
POWERUP_BOOM_FLASH_DURATION = 0.5 # seconds
POWERUP_BOOM_CHAIN_EXPLOSIONS = 3
POWERUP_BOOM_CHAIN_DELAY = 0.2 # seconds between each asteroid explosion in the chain
# Power-up and Explosion Sounds
SOUND_POWERUP_COLLECT = "assets/sound/power-ups/health.ogg"
SOUND_EXPLOSION_MAIN = "assets/sound/power-ups/boom.ogg"
SOUND_ASTEROID_EXPLODE = "assets/sound/power-ups/asteroid-die.ogg"
# Power-up spawn rate multipliers (higher = more frequent spawns)
DIFFICULTY_POWERUP_SPAWN_MULTIPLIERS = {
"Empty Space": 1.0,
"Normal Space": 2.0,
"We did not agree on that": 4.0,
"You kidding": 8.0,
"Hell No!!!": 16.0
}