Add shiny indicators to starter screen

pull/2/head
Flashfyre 2023-10-29 23:36:29 -04:00
parent c0a5d86ab1
commit 3e092876ad
1 changed files with 17 additions and 0 deletions

View File

@ -67,6 +67,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
private starterIcons: Phaser.GameObjects.Sprite[];
private genCursorObj: Phaser.GameObjects.Image;
private genCursorHighlightObj: Phaser.GameObjects.Image;
private shinyIcons: Phaser.GameObjects.Image[];
private starterSelectCallback: StarterSelectCallback;
@ -204,6 +205,17 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
return icon;
});
this.shinyIcons = new Array(81).fill(null).map((_, i) => {
const x = (i % 9) * 18;
const y = Math.floor(i / 9) * 18;
const ret = this.scene.add.image(x + 161, y + 11, 'shiny_star');
ret.setOrigin(0, 0);
ret.setScale(0.5);
ret.setVisible(false);
this.starterSelectContainer.add(ret);
return ret;
});
this.pokemonSprite = this.scene.add.sprite(53, 63, `pkmn__sub`);
this.starterSelectContainer.add(this.pokemonSprite);
@ -488,6 +500,11 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.starterCursorObjs[s].setVisible(this.starterGens[s] === cursor);
for (let s = 0; s < this.pokerusCursorObjs.length; s++)
this.pokerusCursorObjs[s].setVisible(this.pokerusGens[s] === cursor);
const genLimit = this.genSpecies[this.genCursor].length;
for (let s = 0; s < 81; s++) {
this.shinyIcons[s].setVisible(s < genLimit && !!this.scene.gameData.getDefaultDexEntry(this.genSpecies[this.genCursor][s], true));
}
} else {
changed = super.setCursor(cursor);