From 702c28e55596c5e78bfbfc62e8750435ccad134f Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 21 Mar 2024 14:53:35 -0400 Subject: [PATCH] Add familiar splash messages --- src/data/splash-messages.ts | 18 ++++++++++++++++++ src/ui/title-ui-handler.ts | 20 ++++++++++++++++++++ src/utils.ts | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 src/data/splash-messages.ts diff --git a/src/data/splash-messages.ts b/src/data/splash-messages.ts new file mode 100644 index 000000000..381df42e7 --- /dev/null +++ b/src/data/splash-messages.ts @@ -0,0 +1,18 @@ +export const splashMessages = [ + 'Join the Discord!', + 'Infinite Levels!', + 'Optional Save Scumming!', + '35 Biomes!', + 'Open Source!', + 'Play with 5x Speed!', + 'Live Bug Testing!', + 'Heavy RoR2 Influence!', + 'Pokémon Risk and Pokémon Rain!', + 'Infinite Fusion at Home!', + 'Broken Egg Moves!', + 'Mubstitute!', + 'Questionable Balancing!', + 'Sudden Difficulty Spikes!', + 'Based on an Unfinished Flash Game!', + 'YNOproject!' +]; \ No newline at end of file diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 20f126ae7..7b0d1cae5 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -3,10 +3,13 @@ import { DailyRunScoreboard } from "./daily-run-scoreboard"; import OptionSelectUiHandler from "./option-select-ui-handler"; import { Mode } from "./ui"; import * as Utils from "../utils"; +import { TextStyle, addTextObject } from "./text"; +import { splashMessages } from "../data/splash-messages"; export default class TitleUiHandler extends OptionSelectUiHandler { private titleContainer: Phaser.GameObjects.Container; private dailyRunScoreboard: DailyRunScoreboard; + private splashMessage: Phaser.GameObjects.Text; constructor(scene: BattleScene, mode: Mode = Mode.TITLE) { super(scene, mode); @@ -25,16 +28,33 @@ export default class TitleUiHandler extends OptionSelectUiHandler { logo.setOrigin(0.5, 0); this.titleContainer.add(logo); + this.splashMessage = addTextObject(this.scene, logo.x + 64, logo.y + logo.displayHeight - 8, '', TextStyle.MONEY, { fontSize: '54px' }); + this.splashMessage.setOrigin(0.5, 0.5); + this.splashMessage.setAngle(-20) + this.titleContainer.add(this.splashMessage); + this.dailyRunScoreboard = new DailyRunScoreboard(this.scene, 1, 49); this.dailyRunScoreboard.setup(); this.titleContainer.add(this.dailyRunScoreboard); + + const originalSplashMessageScale = this.splashMessage.scale; + + this.scene.tweens.add({ + targets: this.splashMessage, + duration: Utils.fixedInt(350), + scale: originalSplashMessageScale * 1.25, + loop: -1, + yoyo: true, + }) } show(args: any[]): boolean { const ret = super.show(args); if (ret) { + this.splashMessage.setText(Utils.randItem(splashMessages)); + const ui = this.getUi(); this.dailyRunScoreboard.update(); diff --git a/src/utils.ts b/src/utils.ts index 4d1d087e7..e96d27969 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -78,6 +78,12 @@ export function randIntRange(min: integer, max: integer): integer { return randInt(max - min, min); } +export function randItem(items: T[]): T { + return items.length === 1 + ? items[0] + : items[randInt(items.length)]; +} + export function randSeedItem(items: T[]): T { return items.length === 1 ? items[0]