Skip to content
Merged
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
7 changes: 6 additions & 1 deletion arcade/examples/sprite_bullets_aimed.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def on_draw(self):
def on_mouse_press(self, x, y, button, modifiers):
""" Called whenever the mouse button is clicked. """

# Play the gun sound
self.gun_sound.play()

# Create a bullet
bullet = arcade.Sprite(
":resources:images/space_shooter/laserBlue01.png",
Expand Down Expand Up @@ -159,10 +162,12 @@ def on_update(self, delta_time):
# Check this bullet to see if it hit a coin
hit_list = arcade.check_for_collision_with_list(bullet, self.coin_list)

# If it did, get rid of the bullet
# If it did, get rid of the bullet and play the hit sound
if len(hit_list) > 0:
bullet.remove_from_sprite_lists()

self.hit_sound.play()

# For every coin we hit, add to the score and remove the coin
for coin in hit_list:
coin.remove_from_sprite_lists()
Expand Down
Loading