[sounds]: Linked obtain sound to chest opening

This commit is contained in:
corner 2020-04-13 13:18:24 +02:00
parent 4e2928bd7f
commit 643ca24bad
2 changed files with 3 additions and 1 deletions

Binary file not shown.

View File

@ -4,7 +4,8 @@ const { Texture, Sound, TileSprite, entity } = asdf;
const texture = new Texture(__dirname + "/../../res/images/tilemap.png"); const texture = new Texture(__dirname + "/../../res/images/tilemap.png");
const sounds = { const sounds = {
forbidden: new Sound(__dirname + "/../../res/sounds/forbidden.wav") forbidden: new Sound(__dirname + "/../../res/sounds/forbidden.wav"),
obtain: new Sound(__dirname + "/../../res/sounds/obtain.wav")
}; };
const Pointer = require("./pointer.js"); const Pointer = require("./pointer.js");
@ -67,6 +68,7 @@ class Chest extends TileSprite {
this.state = state.open; this.state = state.open;
this.pressed = true; this.pressed = true;
this.action(); this.action();
sounds.obtain.play();
} else { } else {
if (!sounds.forbidden.playing && !this.pressed) { if (!sounds.forbidden.playing && !this.pressed) {
sounds.forbidden.play(); sounds.forbidden.play();