Skip to content

Instantly share code, notes, and snippets.

@jhauge
Created January 31, 2017 20:43
Show Gist options
  • Save jhauge/080e1915186d7ad478d6470100fae0c9 to your computer and use it in GitHub Desktop.
Save jhauge/080e1915186d7ad478d6470100fae0c9 to your computer and use it in GitHub Desktop.
bitbox homework app
// Setup
fill('balsa')
homework = stamp('homework')
exploding = true
alarm = stamp('alarm',650,100,180)
alarm.tap = soundAlarm
// Start nedtælling til eksplosion
function soundAlarm() {
sound('alert',25,100)
alarm.tap = silenceAlarm
exploding = true
delay(explode,5000)
}
// Eksploder, hvis vi stadig vil eksplodere
function explode() {
if (exploding) {
silence()
sound('explode')
homework.explode()
}
}
// Stop nedtælling og eksplosion
function silenceAlarm() {
silence()
sound('applause')
exploding = false
alarm.tap = soundAlarm
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment