active fill

This commit is contained in:
ntr 2018-11-20 22:48:26 +11:00
parent e4c9efc4ec
commit 7b359f7fb4

View File

@ -27,15 +27,18 @@ class CrypRow extends Phaser.GameObjects.Group {
const X_ORIGIN = xPos(i);
const Y_ORIGIN = yPos(i);
// only draw for active cryps
if (cryp.active) {
const row = list.add
.rectangle(X_ORIGIN, Y_ORIGIN, ROW_WIDTH, ROW_HEIGHT, ROW_FILL * Math.random())
.setInteractive()
.setOrigin(0);
this.add(row);
row.cryp = cryp;
}
const ACTIVE_FILL = cryp.active
? 1
: 0;
const row = list.add
.rectangle(X_ORIGIN, Y_ORIGIN, ROW_WIDTH, ROW_HEIGHT, ROW_FILL * Math.random(), ACTIVE_FILL)
.setInteractive()
.setOrigin(0);
row.on('pointerdown', () => {
list.displaySkills(cryp);
});
if (KEY_MAP[i]) {
this.keyboard.on(KEY_MAP[i], () => {
@ -43,6 +46,8 @@ class CrypRow extends Phaser.GameObjects.Group {
}, this);
}
row.cryp = cryp;
this.add(row);
this.add(list.add.text(X_ORIGIN, Y_ORIGIN + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER));
this.add(list.add.text(ROW_WIDTH - 20, Y_ORIGIN + (TEXT_MARGIN * 0), i + 1, TEXT.HEADER));
this.add(list.add.text(X_ORIGIN, Y_ORIGIN + (TEXT_MARGIN * 1), cryp.stamina.base, TEXT.NORMAL));