Created
June 13, 2018 14:58
-
-
Save gildotdev/a4f218d24b20b5adceebc69aa848947d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Hits = 0 | |
let Health = 0 | |
input.buttonB.onEvent(ButtonEvent.Down, function () { | |
if (Health == 1) { | |
pins.A7.digitalWrite(true) | |
network.infraredSendNumber(Colors.Black) | |
pins.A7.digitalWrite(false) | |
} | |
}) | |
network.onInfraredReceivedNumber(function (receivedNumber) { | |
pins.A7.digitalWrite(true) | |
if (Hits == 9) { | |
Health = 0 | |
} | |
if (Health == 1) { | |
light.setPixelColor(Hits, receivedNumber) | |
Hits += 1 | |
} else { | |
light.setAll(Colors.Red) | |
music.playSoundUntilDone(music.sounds(Sounds.PowerDown)) | |
} | |
pins.A7.digitalWrite(false) | |
}) | |
light.setAll(0xffffff) | |
Health = 1 | |
Hits = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment