Added text box to portals

This commit is contained in:
Arne van Iterson 2020-04-16 12:17:32 +02:00
parent 0ee8ca5b30
commit c6bc46b961
2 changed files with 5 additions and 2 deletions

View File

@ -25,7 +25,6 @@ module.exports = {
lives: "Lives",
stamina: "Stamina",
keyFind: "You found a key!",
keyMiss: "You do not have the key for this door!",
chestOpen: "You already opened this chest"
keyMissing: "You do not have the key for this door!"
}
};

View File

@ -7,6 +7,9 @@ const sounds = {
forbidden: new Sound(__dirname + "/../../res/sounds/forbidden.wav")
};
const TextBox = require(__dirname + "/../helpers/textbox.js");
const text = require(__dirname + "/../../res/lang/default.js");
var Pointer = require("./pointer.js");
class Portal extends TileSprite {
@ -90,6 +93,7 @@ class Portal extends TileSprite {
this.pointer.anims.play("red");
if (this.keys.action) {
if (!sounds.forbidden.playing && !this.pressed) {
this.level.entities.add(new TextBox(text.game.keyMissing, 2.5));
sounds.forbidden.play();
this.pressed = true;
}