Merge branch 'master' of ssh://cryps.gg:40022/~/cryps

This commit is contained in:
Mashy 2019-03-05 14:57:42 +10:00
commit 26250d5b74

View File

@ -1,7 +1,7 @@
const Phaser = require('phaser');
const { throttle } = require('lodash');
const { POSITIONS: { COMBAT }} = require('./constants');
const { TEXT, POSITIONS: { COMBAT }} = require('./constants');
const CombatLog = require('./combat.log');
const CombatCryps = require('./combat.cryps');
const CombatSkills = require('./combat.skills');
@ -102,17 +102,20 @@ class Combat extends Phaser.Scene {
addLeaveGame() {
const leaveGame = () => this.cleanUp();
this.input.keyboard.on('keydown_BACKSPACE', leaveGame, 0, this);
const buttonProps = {
x: COMBAT.width() * 0.8,
y: COMBAT.height() * 0.8,
width: COMBAT.width() * 0.15,
height: COMBAT.height() * 0.1,
colour: [0.7, 0.2, 0],
glTag: 'leave',
bText: 'Leave Game',
callback: leaveGame,
};
// this.box = this.add.existing(new Button(this, buttonProps));
const LEAVE_HEIGHT = COMBAT.height() / 6;
const LEAVE_WIDTH = COMBAT.width() / 5;
const LEAVE_X = COMBAT.width() * 0.8;
const LEAVE_Y = COMBAT.height() * 0.9;
const menu = this.add
.rectangle(LEAVE_X, LEAVE_Y, LEAVE_WIDTH, LEAVE_HEIGHT, 0x440000)
.setInteractive()
.setOrigin(0)
.on('pointerdown', leaveGame);
this.add
.text(menu.getCenter().x, menu.getCenter().y, 'Menu', TEXT.HEADER)
.setOrigin(0.5, 0.5);
}
cleanUp() {