@@ -37,7 +37,6 @@ async def main() -> None:
3737 # Pre-load sounds after pygame.init() but before game starts
3838 preload_sounds ()
3939
40- # Display "Click to Start" message for browser compatibility
4140 try :
4241 font = pygame .font .Font (None , 48 )
4342 small_font = pygame .font .Font (None , 24 )
@@ -47,40 +46,7 @@ async def main() -> None:
4746 font = None
4847 small_font = None
4948
50- print ("Waiting for user interaction..." )
51- # Wait for user click (required for browser audio/input)
52- waiting = True
53- frame_count = 0
54- while waiting :
55- frame_count += 1
56- if frame_count % 60 == 0 : # Log every 60 frames (~1 second)
57- print (f"Still waiting... frame { frame_count } " )
58-
59- win_surf .fill ((0 , 0 , 0 ))
60-
61- if font and small_font :
62- title = font .render ("Pygame Side Scroller" , True , (74 , 144 , 226 ))
63- prompt = small_font .render ("Click anywhere to start" , True , (255 , 255 , 255 ))
64- win_surf .blit (title , (800 // 2 - title .get_width ()// 2 , 250 ))
65- win_surf .blit (prompt , (800 // 2 - prompt .get_width ()// 2 , 320 ))
66- else :
67- # Fallback if fonts don't load - draw a white rectangle
68- pygame .draw .rect (win_surf , (255 , 255 , 255 ), (300 , 250 , 200 , 100 ))
69-
70- pygame .display .flip ()
71-
72- for event in pygame .event .get ():
73- if event .type == pygame .QUIT :
74- print ("Quit event received" )
75- return
76- if event .type == pygame .MOUSEBUTTONDOWN or event .type == pygame .KEYDOWN :
77- print (f"User interaction detected: { event .type } " )
78- waiting = False
79-
80- await asyncio .sleep (0 ) # Yield to browser
81-
8249 print ("Starting game loop..." )
83- # Now start the actual game
8450 game_loop = GameLoop (win_surf )
8551 await game_loop .draw ()
8652
0 commit comments