select cryp names
This commit is contained in:
parent
edc7faec5d
commit
7520d85c67
@ -44,6 +44,18 @@ class CrypName extends Phaser.GameObjects.Text {
|
||||
constructor(scene, x, y, cryp) {
|
||||
super(scene, x, y, cryp.name, TEXT.HEADER);
|
||||
}
|
||||
|
||||
select() {
|
||||
this.setTint(0x00ff00);
|
||||
}
|
||||
|
||||
activate() {
|
||||
this.setTint(0xff0000);
|
||||
}
|
||||
|
||||
deselect() {
|
||||
this.clearTint();
|
||||
}
|
||||
}
|
||||
|
||||
class CrypSkill extends Phaser.GameObjects.Text {
|
||||
@ -152,7 +164,8 @@ class CombatSkills extends Phaser.Scene {
|
||||
const namePos = skillTextPosition(i, 0);
|
||||
|
||||
// Draw the cryp name
|
||||
this.add.existing(new CrypName(this, namePos[0], namePos[1], cryp));
|
||||
const crypName = new CrypName(this, namePos[0], namePos[1], cryp);
|
||||
this.add.existing(crypName);
|
||||
|
||||
// return early if KOd
|
||||
if (cryp.hp.base === 0) return true;
|
||||
@ -160,7 +173,7 @@ class CombatSkills extends Phaser.Scene {
|
||||
// draw the skills
|
||||
const skillButtons = cryp.skills.map((skill, j) => addSkill(i, j, skill, cryp));
|
||||
|
||||
const bindCrypKeys = () => this.mapSkillKeys(skillButtons, game.id, cryp.id, team.id, enemyTeam.id, i);
|
||||
const bindCrypKeys = () => this.mapSkillKeys(skillButtons, crypName, game.id, cryp.id, team.id, enemyTeam.id, i);
|
||||
|
||||
// reset everything
|
||||
keyboard.on('keydown_ESC', bindCrypKeys, this);
|
||||
@ -173,7 +186,7 @@ class CombatSkills extends Phaser.Scene {
|
||||
return true;
|
||||
}
|
||||
|
||||
mapSkillKeys(skillButtons, gameId, crypId, alliesId, enemyId, i) {
|
||||
mapSkillKeys(skillButtons, crypName, gameId, crypId, alliesId, enemyId, i) {
|
||||
const { keyboard } = this.input;
|
||||
|
||||
// deselect any currently active button
|
||||
@ -181,6 +194,10 @@ class CombatSkills extends Phaser.Scene {
|
||||
this.activeSkill.deselect();
|
||||
}
|
||||
|
||||
if (this.activeName) {
|
||||
this.activeName.deselect();
|
||||
}
|
||||
|
||||
keyboard.removeListener(CRYP_KEY_MAP[i]);
|
||||
|
||||
keyboard.on(CRYP_KEY_MAP[i], () => {
|
||||
@ -189,8 +206,13 @@ class CombatSkills extends Phaser.Scene {
|
||||
// deselect any currently active button
|
||||
if (this.activeSkill) {
|
||||
this.activeSkill.deselect();
|
||||
this.activeName.deselect();
|
||||
}
|
||||
|
||||
crypName.select();
|
||||
console.log(crypName);
|
||||
this.activeName = crypName;
|
||||
|
||||
skillButtons.forEach((button, j) => {
|
||||
keyboard.on(SKILL_KEY_MAP[j], () => {
|
||||
this.activeSkill = button;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user