Added background music#10
Conversation
…PS to 60 for smoother game.
Added Sound class to eliminate need for second pg.init(). Sound class can be used to play any other sounds in the game.
Added jump sound
ggggg
left a comment
There was a problem hiding this comment.
Great job, sounds seem to work perfectly! Also thank you for fixing some of the code smells and naming conventions.
Just a few tiny things for improvement,
- If the music file is not found the game crashes with a FileNotFoundError, this might not be intended behaviour, maybe we could run the game without that sound and issue a warning in the console?
- Is it possible to turn down the background music by a bit? Its not terribly loud by I prefer it to be less prominent
- Can we add a "game over" sound?
Co-authored-by: Ido <benhaim.ido@gmail.com>
|
Thank you for the feedback. I added a game over sound and reduced the volume of the background music. Please let me know if the music is at a better volume now. I also did some handling for the FileNotFoundError, however I made it such that if one file is missing, there are no game sounds because I'm still trying to figure out how to determine which specific file is missing and handle it that way. |
ggggg
left a comment
There was a problem hiding this comment.
There are no game sounds because I'm still trying to figure out how to determine which specific file is missing and handle it that way.
maybe we could have that logic in aloadSound(name, path)method?
| if not self.sound.no_music: | ||
| self.sound.play('jump') |
There was a problem hiding this comment.
This kind of logic should probably be in the sound class
| sound = Sound() | ||
| if not sound.no_music: | ||
| sound.play('background_music') | ||
| else: | ||
| print("Warning: A Music file could not be found. The game will run without music.") | ||
|
|
There was a problem hiding this comment.
Maybe put this logic in the sound class (play method)
|
@nitic04 any updates on this PR? |
Added the background music that plays when the game is launched. Also added the music file credit to the readme file.