Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Assets/Assets_Grenade+1.wav
Binary file not shown.
Binary file added Assets/Assets_Gun+Silencer.wav
Binary file not shown.
12 changes: 6 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

BORDER = pygame.Rect(WIDTH//2 - 5, 0, 10, HEIGHT)

#BULLET_HIT_SOUND = pygame.mixer.Sound('Assets/Grenade+1.mp3')
#BULLET_FIRE_SOUND = pygame.mixer.Sound('Assets/Gun+Silencer.mp3')
BULLET_HIT_SOUND = pygame.mixer.Sound('Assets/Grenade+1.wav') # Using the wav formatted audio file
BULLET_FIRE_SOUND = pygame.mixer.Sound('Assets/Gun+Silencer.wav') # Using the wav formatted audio file

HEALTH_FONT = pygame.font.SysFont('comicsans', 40)
WINNER_FONT = pygame.font.SysFont('comicsans', 100)
Expand Down Expand Up @@ -138,21 +138,21 @@ def main():
bullet = pygame.Rect(
yellow.x + yellow.width, yellow.y + yellow.height//2 - 2, 10, 5)
yellow_bullets.append(bullet)
#BULLET_FIRE_SOUND.play()
BULLET_FIRE_SOUND.play()

if event.key == pygame.K_RCTRL and len(red_bullets) < MAX_BULLETS:
bullet = pygame.Rect(
red.x, red.y + red.height//2 - 2, 10, 5)
red_bullets.append(bullet)
#BULLET_FIRE_SOUND.play()
BULLET_FIRE_SOUND.play()

if event.type == RED_HIT:
red_health -= 1
#BULLET_HIT_SOUND.play()
BULLET_HIT_SOUND.play()

if event.type == YELLOW_HIT:
yellow_health -= 1
#BULLET_HIT_SOUND.play()
BULLET_HIT_SOUND.play()

winner_text = ""
if red_health <= 0:
Expand Down