-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex.py
More file actions
27 lines (20 loc) · 627 Bytes
/
Copy pathex.py
File metadata and controls
27 lines (20 loc) · 627 Bytes
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
import pygame
# Initialize Pygame
pygame.init()
# Initialize the mixer (optional but good practice)
pygame.mixer.init()
# Load the sound
click_sound = pygame.mixer.Sound("Flappy Death.wav")
# Set up a basic display (required for event loop)
screen = pygame.display.set_mode((400, 300))
pygame.display.set_caption("Play Sound Example")
# Main loop
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Play sound when you click the mouse
if event.type == pygame.MOUSEBUTTONDOWN:
click_sound.play()
pygame.quit()