Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added background music #10

Open
wants to merge 10 commits into
base: 8-add-music-to-game
Choose a base branch
from
Open

Conversation

nitic04
Copy link
Contributor

@nitic04 nitic04 commented Nov 18, 2023

Added the background music that plays when the game is launched. Also added the music file credit to the readme file.

@ggggg ggggg self-requested a review November 18, 2023 04:21
@ggggg ggggg linked an issue Nov 18, 2023 that may be closed by this pull request
Copy link
Collaborator

@ggggg ggggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

constants.py Outdated Show resolved Hide resolved
nitic04 and others added 2 commits November 17, 2023 23:34
@nitic04
Copy link
Contributor Author

nitic04 commented Nov 19, 2023

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.

Copy link
Collaborator

@ggggg ggggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a loadSound(name, path) method?

Comment on lines +26 to +27
if not self.sound.no_music:
self.sound.play('jump')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of logic should probably be in the sound class

Comment on lines +30 to +35
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.")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put this logic in the sound class (play method)

@ggggg
Copy link
Collaborator

ggggg commented Dec 23, 2023

@nitic04 any updates on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add music to game
3 participants