-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
528 lines (480 loc) · 21.8 KB
/
main.py
File metadata and controls
528 lines (480 loc) · 21.8 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
import pygame
import sys
import os
import math
import time
import random
import json
# --- Init ---
pygame.init()
# --- Constants ---
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
FPS = 60
LINE_COUNT = 4
LINE_SPACING = 80
MARIO_SIZE = 20
MARIO_SPEED_DEFAULT = 1.1
MARIO_SPEED_3 = MARIO_SPEED_DEFAULT * 1.5
MARIO_SPEED_FAST = MARIO_SPEED_DEFAULT * 4.2
MARIO_SPEED = MARIO_SPEED_DEFAULT
SLIDE_SPEED = 2
PIPE_Y = WINDOW_HEIGHT - 40
MAX_PATH_LENGTH = WINDOW_HEIGHT // 10
MUSIC_FOLDER = "music/"
SOUNDS_FOLDER = "sounds/"
SPRITES_FOLDER = "sprites/"
# --- Sound Paths ---
MAIN_MUSIC = MUSIC_FOLDER + "slides.wav" # Plays whole time
SOUND_PATH = SOUNDS_FOLDER + "scream.wav" # plays on death
WIN_SOUND_PATH = SOUNDS_FOLDER + "win.wav"
MARIO_HAHA_PATH = SOUNDS_FOLDER + "mario_haha.wav" # plays on win
DRAW_SOUND_PATH = SOUNDS_FOLDER + "line_drawing.mp3"
SNAP_SOUND_PATH = SOUNDS_FOLDER + "line_snap.wav"
POP_SOUND_PATH = SOUNDS_FOLDER + "mario_switch.wav"
SPEEDUP_SOUND_PATH = SOUNDS_FOLDER + "mario_switch.wav" # figure out how to play at higher pitch with higher speed
# --- Sprites ---
SPRITE_MARIO_PATH = SPRITES_FOLDER + "mario.png"
SPRITE_STAR_PATH = SPRITES_FOLDER + "star.png"
SPRITE_PIPE_PATH = SPRITES_FOLDER + "pipe.png"
SPRITE_PIRANHA_PATH = SPRITES_FOLDER + "piranha.png"
SPRITE_BG_PATH = SPRITES_FOLDER + "bg.png"
# --- Configurable Mario Start VLINE ---
MARIO_SIZE = 32
STAR_SIZE = 16
MARIO_START_VLINE = 0 # 0 = VLINE 1, 1 = VLINE 2, etc.
VLINE_STAR = None # 1-based index for user, will convert to 0-based
RANDOMIZE_STAR_LOCATION = False
# Load images as Surfaces
SPRITE_MARIO = pygame.image.load(SPRITE_MARIO_PATH) if os.path.exists(SPRITE_MARIO_PATH) else pygame.Surface((MARIO_SIZE, MARIO_SIZE))
SPRITE_STAR = pygame.image.load(SPRITE_STAR_PATH) if os.path.exists(SPRITE_STAR_PATH) else pygame.Surface((STAR_SIZE, STAR_SIZE))
SPRITE_PIPE = pygame.image.load(SPRITE_PIPE_PATH) if os.path.exists(SPRITE_PIPE_PATH) else pygame.Surface((20, 20))
SPRITE_PIRANHA = pygame.image.load(SPRITE_PIRANHA_PATH) if os.path.exists(SPRITE_PIRANHA_PATH) else pygame.Surface((20, 20))
# --- Assets ---
scream_sound = pygame.mixer.Sound(SOUND_PATH) if os.path.exists(SOUND_PATH) else None
win_sound = pygame.mixer.Sound(WIN_SOUND_PATH) if os.path.exists(WIN_SOUND_PATH) else None
mario_haha_sound = pygame.mixer.Sound(MARIO_HAHA_PATH) if os.path.exists(MARIO_HAHA_PATH) else None
draw_sound = pygame.mixer.Sound(DRAW_SOUND_PATH) if os.path.exists(DRAW_SOUND_PATH) else None
snap_sound = pygame.mixer.Sound(SNAP_SOUND_PATH) if os.path.exists(SNAP_SOUND_PATH) else None
pop_sound = pygame.mixer.Sound(POP_SOUND_PATH) if os.path.exists(POP_SOUND_PATH) else None
speedup_sound = pygame.mixer.Sound(SPEEDUP_SOUND_PATH) if os.path.exists(SPEEDUP_SOUND_PATH) else None
error_sound = pygame.mixer.Sound(SOUNDS_FOLDER + "error.wav") if os.path.exists(SOUNDS_FOLDER + "error.wav") else None
# --- Setup ---
screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
pygame.display.set_caption("Mario's Slides")
clock = pygame.time.Clock()
# --- Game State Variables ---
VLINE_STATE = [0] * LINE_COUNT
PATH = 0
VLINE_PERCENTAGE = 0
ABOUT_TO_DIE = 1
ABOUT_TO_WIN = 0
DIST_NEXT_PATH = 0
SEC_ALIVE = 0.00
TIME_TO_WIN = None
start_time = 0.0
used_webs = set() # Track used webs for sliding
websAmount = 0
STAR_IDX = None # 0-based index for star sprite location
wonGames = 0 # Track number of games won
waiting_for_win_sound = False # Track if waiting for win sound to finish
win_sound_end_time = 0
paused = False
TOTAL_TIME_TO_WIN = 0.0
# --- Background Config ---
BG_WIDTH = 500 # You can adjust this
BG_HEIGHT = 600 # You can adjust this
BG_SCALE = 1.7 # You can adjust this (1.0 = no scale, >1 = bigger)
SPRITE_BG = pygame.image.load(SPRITE_BG_PATH) if os.path.exists(SPRITE_BG_PATH) else pygame.Surface((BG_WIDTH, BG_HEIGHT))
def save_web_map(filename="webMap.json"):
try:
# Save as a list of [[x1, y1], [x2, y2]] for each web
web_list = [[list(start), list(end)] for start, end in webs]
with open(filename, "w") as f:
json.dump(web_list, f, indent=2)
print(f"Web map saved to {filename}")
except Exception as e:
print(f"Error saving web map: {e}")
def load_web_map(filename="webMap.json"):
global webs, websAmount
try:
with open(filename, "r") as f:
web_list = json.load(f)
webs = [ (tuple(start), tuple(end)) for start, end in web_list ]
websAmount = len(webs)
print(f"Web map loaded from {filename}")
except Exception as e:
print(f"Error loading web map: {e}")
def play_music():
if os.path.exists(MAIN_MUSIC):
pygame.mixer.music.load(MAIN_MUSIC)
pygame.mixer.music.play(-1)
def reset_game():
global lines_x, mario_x, mario_y, mario_sliding, pipes, drawing, start_point, webs
global game_over, slide_target, prev_path, start_time, SEC_ALIVE, VLINE_STAR, websAmount, TIME_TO_WIN, TOTAL_TIME_TO_WIN, MARIO_SPEED
global STAR_IDX, waiting_for_win_sound, win_sound_end_time
if 'webs' not in globals():
webs = []
play_music()
lines_x = [LINE_SPACING * (i + 1) for i in range(LINE_COUNT)]
VLINE_STAR = random.randint(1, LINE_COUNT) # 1-based index for win VLINE
STAR_IDX = VLINE_STAR - 1 # Star sprite always matches the win VLINE
mario_x = lines_x[random.randint(0, LINE_COUNT - 1)] - MARIO_SIZE // 2 # Random VLINE for Mario
mario_y = 0
mario_sliding = False
slide_target = None
prev_path = None
pipes = []
for i, x in enumerate(lines_x):
color = (255, 255, 0) if i == STAR_IDX else (0, 255, 0)
rect = pygame.Rect(x - 10, PIPE_Y, 20, 20)
pipes.append((rect, color))
drawing = False
start_point = None
game_over = False
start_time = time.time()
SEC_ALIVE = 0.00
TIME_TO_WIN = None
waiting_for_win_sound = False
win_sound_end_time = 0
# Only clear webs if less than 3 wins and webs was not just loaded
if wonGames < 3 and not getattr(reset_game, 'skip_webs_clear', False):
webs.clear()
websAmount = 0
if wonGames > 2:
MARIO_SPEED = MARIO_SPEED_3
if wonGames == 3: # Equivalent to rounds getting progressively harder. Also wongames being 3 means that this won't run ever again.
webs.clear()
load_web_map("3_Round_webMap.json")
elif wonGames == 5: # After 5 wins, load a different web map
webs.clear()
load_web_map("5_Round_webMap.json")
elif wonGames == 10: # After 10 wins, load a different web map
webs.clear()
load_web_map("10_Round_webMap.json")
# After 3 wins, do NOT clear webs, so they persist
# Reset the skip_webs_clear flag
if hasattr(reset_game, 'skip_webs_clear'):
delattr(reset_game, 'skip_webs_clear')
reset_game()
running = True
while running:
clock.tick(FPS)
if not game_over:
SEC_ALIVE = round(time.time() - start_time, 2)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_p:
paused = not paused
if event.key == pygame.K_r:
wonGames = 0
TOTAL_TIME_TO_WIN = 0.0
reset_game()
wonGames = 0 # double reset to ensure wonGames is reset.
TOTAL_TIME_TO_WIN = 0.0
elif event.key == pygame.K_k:
save_web_map("webMap.json")
elif event.key == pygame.K_l:
load_web_map("webMap.json")
reset_game.skip_webs_clear = True
reset_game()
elif event.key == pygame.K_j:
load_web_map("3_Round_webMap.json")
reset_game.skip_webs_clear = True
reset_game()
elif event.key == pygame.K_u:
wonGames += 1
elif event.key == pygame.K_SPACE:
MARIO_SPEED = MARIO_SPEED_FAST
if speedup_sound:
speedup_sound.play()
if event.type == pygame.KEYUP:
if event.key == pygame.K_SPACE:
MARIO_SPEED = MARIO_SPEED_DEFAULT if wonGames < 3 else MARIO_SPEED_3
if event.type == pygame.MOUSEBUTTONDOWN and not game_over:
mx, my = pygame.mouse.get_pos()
nearest_x = min(lines_x, key=lambda x: abs(mx - x))
if abs(mx - nearest_x) < 15:
snapped_y = round(my / 10) * 10
start_point = (nearest_x, snapped_y)
drawing = True
if draw_sound:
draw_sound.play(-1)
if event.type == pygame.MOUSEBUTTONUP and drawing:
mx, my = pygame.mouse.get_pos()
nearest_x = min(lines_x, key=lambda x: abs(mx - x))
if abs(mx - nearest_x) < 15:
snapped_y = round(my / 10) * 10
end_point = (nearest_x, snapped_y)
# Ensure start_point and end_point are not None before using
if start_point is not None and end_point is not None and start_point[0] != end_point[0]:
idx1 = lines_x.index(start_point[0])
idx2 = lines_x.index(end_point[0])
if abs(idx1 - idx2) == 1:
dy = abs(end_point[1] - start_point[1])
if dy > MAX_PATH_LENGTH:
direction = 1 if end_point[1] > start_point[1] else -1
end_point = (end_point[0], start_point[1] + direction * MAX_PATH_LENGTH)
valid = True
# --- Flexible web overlap check: only block if any pixel is already on a web ---
for existing_start, existing_end in webs:
# Check for pixel overlap between the new web and any existing web
# Use a simple line segment intersection test
def ccw(A, B, C):
return (C[1]-A[1]) * (B[0]-A[0]) > (B[1]-A[1]) * (C[0]-A[0])
def segments_intersect(A,B,C,D):
return (ccw(A,C,D) != ccw(B,C,D)) and (ccw(A,B,C) != ccw(A,B,D))
if segments_intersect(start_point, end_point, existing_start, existing_end):
valid = False
break
if valid:
webs.append((start_point, end_point))
websAmount += 1
if snap_sound:
snap_sound.play()
else:
if error_sound:
error_sound.play()
drawing = False
start_point = None
if draw_sound:
draw_sound.stop()
if paused:
pause_font = pygame.font.SysFont(None, 80, bold=True)
pause_text = pause_font.render("PAUSED", True, (255, 255, 0))
pause_rect = pause_text.get_rect(center=(WINDOW_WIDTH // 2, WINDOW_HEIGHT // 2))
screen.blit(pause_text, pause_rect)
pygame.display.flip()
continue
if not game_over:
mario_center_x = mario_x + MARIO_SIZE // 2
mario_center_y = mario_y + MARIO_SIZE // 2
VLINE_STATE = [0] * LINE_COUNT
PATH = 1 if mario_sliding else 0
VLINE_PERCENTAGE = min(100, int((mario_y / (PIPE_Y)) * 100))
ABOUT_TO_DIE = 1
ABOUT_TO_WIN = 0
DIST_NEXT_PATH = 100
for i, x in enumerate(lines_x):
if abs(mario_center_x - x) < 5:
VLINE_STATE[i] = 1
mario_vline_idx = i
break
else:
mario_vline_idx = None
# --- ABOUT_TO_DIE and ABOUT_TO_WIN logic ---
web_below = False
min_web_y = None
next_web_dist = None
if mario_vline_idx is not None:
mario_cx = mario_x + MARIO_SIZE // 2
mario_cy = mario_y + MARIO_SIZE // 2
for start, end in webs:
# Only consider webs that span across VLINEs
x1, y1 = start
x2, y2 = end
# Check if Mario's X is between the web's endpoints (inclusive)
if min(x1, x2) <= mario_cx <= max(x1, x2):
# Calculate the Y on the web at Mario's X using linear interpolation
if x1 != x2:
t = (mario_cx - x1) / (x2 - x1)
web_y_at_mario_x = y1 + t * (y2 - y1)
else:
web_y_at_mario_x = y1 # vertical web
if web_y_at_mario_x > mario_cy:
web_below = True
dist = web_y_at_mario_x - mario_cy
if next_web_dist is None or dist < next_web_dist:
next_web_dist = dist
if min_web_y is None or web_y_at_mario_x < min_web_y:
min_web_y = web_y_at_mario_x
if web_below:
ABOUT_TO_DIE = 0
if mario_sliding:
ABOUT_TO_DIE = 0
star_idx = (VLINE_STAR - 1) if VLINE_STAR is not None else 0
if mario_vline_idx == star_idx:
ABOUT_TO_DIE = 0
max_web_y = -1
for start, end in webs:
if (start[0] == lines_x[star_idx] or end[0] == lines_x[star_idx]):
web_y = start[1]
if web_y > max_web_y:
max_web_y = web_y
if mario_y + MARIO_SIZE // 2 > max_web_y:
ABOUT_TO_WIN = 1
if web_below and mario_vline_idx == star_idx:
ABOUT_TO_WIN = 0
# --- DIST_NEXT_WEB logic ---
if next_web_dist is not None:
DIST_NEXT_WEB = int(next_web_dist)
else:
# If Mario is below all webs on his VLINE, set to -1
DIST_NEXT_WEB = -1
# --- Used webs logic ---
if mario_y <= 0:
used_webs.clear()
# --- Smooth sliding logic with used webs ---
if mario_sliding:
dx = slide_target[0] - mario_x
dy = slide_target[1] - mario_y
dist = math.hypot(dx, dy)
if dist <= MARIO_SPEED:
mario_x = slide_target[0]
mario_y = slide_target[1]
mario_sliding = False
if pop_sound: # avoid crash
pop_sound.play() # Play pop sound when Mario gets off the web
else:
step_x = MARIO_SPEED * (dx / dist)
step_y = MARIO_SPEED * (dy / dist)
mario_x += step_x
mario_y += step_y
else:
hopped = False
mario_cx = mario_x + MARIO_SIZE // 2
mario_cy = mario_y + MARIO_SIZE // 2
# --- Improved web detection for high speed ---
web_hopped_this_frame = False
if DIST_NEXT_WEB != -1 and ABOUT_TO_DIE == 0 and ABOUT_TO_WIN == 0:
next_cy = mario_cy + MARIO_SPEED
for start, end in webs:
web_id = tuple(sorted([start, end]))
x1, y1 = start
x2, y2 = end
if min(x1, x2) - 1 <= mario_cx <= max(x1, x2) + 1:
dx, dy = x2 - x1, y2 - y1
if dx == dy == 0:
continue
t = max(0, min(1, ((mario_cx - x1) * dx + (mario_cy - y1) * dy) / (dx * dx + dy * dy)))
px, py = x1 + t * dx, y1 + t * dy
distance = math.hypot(mario_cx - px, mario_cy - py)
# --- Symmetric web detection: allow hopping from either endpoint ---
if distance < MARIO_SPEED + MARIO_SIZE / 4 and web_id not in used_webs:
# Always slide to the endpoint that is NOT closest to Mario's current position
if math.hypot(mario_cx - x1, mario_cy - y1) < math.hypot(mario_cx - x2, mario_cy - y2):
target = end
else:
target = start
slide_target = (target[0] - MARIO_SIZE // 2, target[1] - MARIO_SIZE // 2)
mario_sliding = True
used_webs.add(web_id)
if pop_sound: pop_sound.play()
hopped = True
web_hopped_this_frame = True
break
if not hopped and not web_hopped_this_frame:
mario_y += MARIO_SPEED
# --- Death check: if Mario falls past the last web and not on a VLINE with a web, he dies ---
if mario_y + MARIO_SIZE >= PIPE_Y:
# If not on star, it's a loss
star_x = lines_x[(VLINE_STAR - 1) if VLINE_STAR is not None else 0]
if abs(mario_center_x - star_x) < 5:
for rect, color in pipes:
if color == (255, 255, 0) and rect.top - mario_y < 5:
if win_sound and mario_haha_sound:
win_sound.play()
mario_haha_sound.play()
game_over = True
TIME_TO_WIN = SEC_ALIVE
wonGames += 1
# Add TIME_TO_WIN to TOTAL_TIME_TO_WIN
TOTAL_TIME_TO_WIN += TIME_TO_WIN if TIME_TO_WIN is not None else 0
reset_game() # Instantly go to next round after win
else:
if scream_sound: scream_sound.play()
game_over = True
# --- Save highscore on death ---
import datetime
highscore_entry = {
"timestamp": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"wonGames": wonGames,
"TOTAL_TIME_TO_WIN": round(TOTAL_TIME_TO_WIN, 2)
}
try:
if os.path.exists("highscore.json"):
with open("highscore.json", "r") as f:
try:
content = f.read().strip()
if not content:
highscores = []
else:
highscores = json.loads(content)
except Exception:
highscores = []
else:
highscores = []
highscores.append(highscore_entry)
with open("highscore.json", "w") as f:
json.dump(highscores, f, indent=2)
except Exception as e:
print(f"Error saving highscore: {e}")
screen.fill((0, 0, 0))
# --- Draw background ---
bg_scaled = pygame.transform.scale(SPRITE_BG, (int(BG_WIDTH * BG_SCALE), int(BG_HEIGHT * BG_SCALE)))
screen.blit(bg_scaled, (-int((BG_WIDTH * BG_SCALE - WINDOW_WIDTH) // 2), -int((BG_HEIGHT * BG_SCALE - WINDOW_HEIGHT) // 2)))
for x in lines_x:
pygame.draw.line(screen, (255, 255, 255), (x, 0), (x, WINDOW_HEIGHT), 2)
for start, end in webs:
pygame.draw.line(screen, (0, 255, 255), start, end, 3)
if drawing and start_point:
mx, my = pygame.mouse.get_pos()
nearest_x = min(lines_x, key=lambda x: abs(mx - x))
if abs(mx - nearest_x) < 15:
snapped_y = round(my / 10) * 10
pygame.draw.line(screen, (0, 128, 255), start_point, (nearest_x, snapped_y), 2)
for i, (rect, color) in enumerate(pipes):
if i == STAR_IDX:
# Center the star image in the actual square (rect)
star_pos = (rect.centerx - SPRITE_STAR.get_width() // 2, rect.centery - SPRITE_STAR.get_height() // 2)
screen.blit(SPRITE_STAR, star_pos)
else:
# is a piranha plant pipe
# Center the pipe image in the same way as the star
pipe_pos = (rect.centerx - SPRITE_PIPE.get_width() // 2, rect.centery - SPRITE_PIPE.get_height() // 2)
screen.blit(SPRITE_PIPE, pipe_pos)
screen.blit(SPRITE_MARIO, (mario_x, mario_y))
font = pygame.font.SysFont(None, 20)
debug = [
f"SEC_ALIVE = {SEC_ALIVE:.2f}",
f"websAmount = {websAmount}",
f"VLINE_1 = {VLINE_STATE[0]}",
f"VLINE_2 = {VLINE_STATE[1]}",
f"VLINE_3 = {VLINE_STATE[2]}",
f"VLINE_4 = {VLINE_STATE[3]}",
f"VLINE_STAR = {VLINE_STAR}",
f"onWeb = {1 if mario_sliding else 0}",
f"DIST_NEXT_WEB = {DIST_NEXT_WEB}",
f"VLINE_PIXELS_AWAY = {VLINE_PERCENTAGE} pixels",
f"ABOUT_TO_DIE = {ABOUT_TO_DIE}",
f"ABOUT_TO_WIN = {ABOUT_TO_WIN}",
f"TIME_TO_WIN = {TIME_TO_WIN if TIME_TO_WIN is not None else 0}",
f"TOTAL_TIME_TO_WIN = {TOTAL_TIME_TO_WIN:.2f}",
f"wonGames = {wonGames}",
]
for i, txt in enumerate(debug):
render = font.render(txt, True, (255, 255, 255))
screen.blit(render, (420, 10 + i * 20))
# --- User Notes (lower right, visually distinct, non-blocking) ---
notes = [
"SPACE to speed up Mario.",
"Press P to pause the game.",
"Press K to save your spider-web layout.",
"Press L to load your saved spider-web map.",
"Press J to load the 3RD Round Map.",
"Press R to reset the game.",
"Press U to increase wonGames (for testing).",
]
note_font = pygame.font.SysFont(None, 20, bold=True)
note_color = (180, 220, 255)
note_y_start = 10 + len(debug) * 20 + 60 # Many lines below debug
for i, note in enumerate(notes):
note_render = note_font.render(note, True, note_color)
note_rect = note_render.get_rect()
note_rect.topright = (WINDOW_WIDTH - 10, note_y_start + i * 24)
screen.blit(note_render, note_rect)
pygame.display.flip()
pygame.quit()
sys.exit()