[Sprite] Add snow to main menu during winter season (#6877)

This commit is contained in:
Madmadness65 2025-12-20 14:39:54 -06:00 committed by GitHub
parent 2256b57370
commit fc42530ca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 0 deletions

View File

@ -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");

View File

@ -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);
}
}