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 Music made by Unsigned Arduino #2
base: master
Are you sure you want to change the base?
Conversation
Just added the music into here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey cool - music. 😀
Would be really nice to use camelCase in the variable and function names.
I'm also wondering why the arguments key_number
, from_color
and to_color
are not used in the play_note
function.
} else { return } | ||
} | ||
music.stopAllSounds() | ||
function play_note(freq: number, length: number, key_number: number, from_color: number, to_color: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key_number
, from_color
and to_color
are not used. 🤔
Names in JavaScript/TypeScript are always camelCase, so this function would be called playNote
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw I did not make most of the code, I mostly just injected it into the game.
function play_note(freq: number, length: number, key_number: number, from_color: number, to_color: number) { | ||
music.playTone(freq, length) | ||
} | ||
play_song() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to playSong
.
@@ -11,7 +11,2468 @@ Players.addPlayerOne(); | |||
if (twoPlayerMode) { | |||
Players.addPlayerTwo(); | |||
} | |||
|
|||
if (game.ask("Do you want Music?", "May Increase Lag")) { | |||
let stop_music: boolean = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to stopMusic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this flag ever set to true
?
|
||
timer.background(function() { | ||
function play_song() { | ||
stop_music = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indendation is broken from here on.
Just added the music into here. It is made optional for lag purposes.