3️⃣

5.3 - Practice Problems

Practice

Sound Tanks!

Edit the code from the tank game so that it will:
  • play an explosion sound when a target is hit or run over
  • play a gunshot sound when a bullet is "fired" (created)
  • play background music during the whole game
You can either use the provided .wav files or find your own (responsibly, of course).
💡
Because the pygame.init is inside App's init method, we don't put sounds here. instead, we make the sounds and the music inside Tankgame's init method. Alternatively, you can move pygame.init before all the classes so that you can have your sounds as constants.
 
⚖️
Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.