Added a basic audio example
@@ -5,13 +5,19 @@ class Game {
static init() {
AudioEngine.load("music", "../spaceshooter/res/around-the-corner.ogg")
AudioEngine.load("sfx", "../spaceshooter/res/Laser_Shoot.wav")
- AudioEngine.play("music")
+ __channel = AudioEngine.play("music")
}
static update() {
- if (Keyboard["space"].justPressed) {
+ if (Keyboard["return"].justPressed) {
AudioEngine.play("sfx")
}
+ if (Keyboard["space"].justPressed) {
+ __channel = AudioEngine.play("music")
+ }
+ if (Keyboard["backspace"].justPressed) {
+ __channel.stop()
+ }
}
static draw(dt) {
Canvas.print("DOME Installed Successfully.", 10, 10, Color.white)
