mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-25 11:09:20 +01:00
[Sprite] Add snow to main menu during winter season (#6877)
This commit is contained in:
parent
2256b57370
commit
fc42530ca3
@ -29,6 +29,7 @@ export class LoadingScene extends SceneBase {
|
||||
this.loadImage("loading_bg", "arenas");
|
||||
this.loadImage("logo", "");
|
||||
this.loadImage("logo_fake", "");
|
||||
this.loadImage("snow", "");
|
||||
|
||||
// Load menu images
|
||||
this.loadAtlas("bg", "ui");
|
||||
|
||||
@ -203,6 +203,11 @@ export class TitleUiHandler extends OptionSelectUiHandler {
|
||||
this.eventDisplay.show();
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
if (now.getMonth() === 11 || (now.getMonth() === 0 && now.getDate() <= 15)) {
|
||||
this.getSnow();
|
||||
}
|
||||
|
||||
this.randomPokemon();
|
||||
this.genderSplash();
|
||||
|
||||
@ -249,4 +254,31 @@ export class TitleUiHandler extends OptionSelectUiHandler {
|
||||
const aprilFools = timedEventManager.isAprilFoolsActive();
|
||||
return aprilFools === !!randInt(FAKE_TITLE_LOGO_CHANCE) ? "logo_fake" : "logo";
|
||||
}
|
||||
|
||||
private snow: Phaser.GameObjects.TileSprite;
|
||||
|
||||
/** Adds a snow effect on the title screen during the winter season. */
|
||||
private getSnow(): void {
|
||||
const width = globalScene.scaledCanvas.width;
|
||||
const height = globalScene.scaledCanvas.height;
|
||||
this.snow = globalScene.add.tileSprite(width, height, width, height, "snow");
|
||||
this.snow.setOrigin(1, 1);
|
||||
|
||||
globalScene.tweens.add({
|
||||
targets: this.snow,
|
||||
tilePositionX: { from: 0, to: -512 },
|
||||
tilePositionY: { from: 0, to: -512 },
|
||||
duration: 100000,
|
||||
repeat: -1,
|
||||
yoyo: false,
|
||||
ease: "Linear",
|
||||
onUpdate: () => {
|
||||
if (this.snow) {
|
||||
this.snow.tilePositionX -= 0.5;
|
||||
this.snow.tilePositionY -= 0.5;
|
||||
}
|
||||
},
|
||||
});
|
||||
this.titleContainer.addAt(this.snow, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user