caa-game/src/screens/gameover.js

36 lines
878 B
JavaScript

const asdf = require("asdf-games");
// eslint-disable-next-line no-unused-vars
const { Texture, Text, Container, Sprite } = asdf;
const text = require(__dirname + "/../../res/lang/default.js");
const fillStyle = {fill: "#ffffff", font: "24px Arial"};
class GameOver extends Container {
constructor(game, keys, onEnd) {
super();
this.game = game;
this.keys = keys;
this.onEnd = onEnd;
this.children = [];
var gameover = new Text(text.gameOver.dead, {fill: "#ffffff", font: "32px Arial"});
gameover.pos = { x: 200, y: 200 };
this.add(gameover);
var instruction = new Text(text.gameOver.instruction, fillStyle);
instruction.pos = { x: 200, y: 236 };
this.add(instruction);
}
update(dt, t) {
super.update(dt, t);
if (this.keys.action) {
this.onEnd();
}
}
}
module.exports = GameOver;