Add familiar splash messages

pull/16/head
Flashfyre 2024-03-21 14:53:35 -04:00
parent 67e3ea13d5
commit 702c28e555
3 changed files with 44 additions and 0 deletions

View File

@ -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!'
];

View File

@ -3,10 +3,13 @@ import { DailyRunScoreboard } from "./daily-run-scoreboard";
import OptionSelectUiHandler from "./option-select-ui-handler"; import OptionSelectUiHandler from "./option-select-ui-handler";
import { Mode } from "./ui"; import { Mode } from "./ui";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { TextStyle, addTextObject } from "./text";
import { splashMessages } from "../data/splash-messages";
export default class TitleUiHandler extends OptionSelectUiHandler { export default class TitleUiHandler extends OptionSelectUiHandler {
private titleContainer: Phaser.GameObjects.Container; private titleContainer: Phaser.GameObjects.Container;
private dailyRunScoreboard: DailyRunScoreboard; private dailyRunScoreboard: DailyRunScoreboard;
private splashMessage: Phaser.GameObjects.Text;
constructor(scene: BattleScene, mode: Mode = Mode.TITLE) { constructor(scene: BattleScene, mode: Mode = Mode.TITLE) {
super(scene, mode); super(scene, mode);
@ -25,16 +28,33 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
logo.setOrigin(0.5, 0); logo.setOrigin(0.5, 0);
this.titleContainer.add(logo); 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 = new DailyRunScoreboard(this.scene, 1, 49);
this.dailyRunScoreboard.setup(); this.dailyRunScoreboard.setup();
this.titleContainer.add(this.dailyRunScoreboard); 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 { show(args: any[]): boolean {
const ret = super.show(args); const ret = super.show(args);
if (ret) { if (ret) {
this.splashMessage.setText(Utils.randItem(splashMessages));
const ui = this.getUi(); const ui = this.getUi();
this.dailyRunScoreboard.update(); this.dailyRunScoreboard.update();

View File

@ -78,6 +78,12 @@ export function randIntRange(min: integer, max: integer): integer {
return randInt(max - min, min); return randInt(max - min, min);
} }
export function randItem<T>(items: T[]): T {
return items.length === 1
? items[0]
: items[randInt(items.length)];
}
export function randSeedItem<T>(items: T[]): T { export function randSeedItem<T>(items: T[]): T {
return items.length === 1 return items.length === 1
? items[0] ? items[0]