From d7d56896be275e38970818a0785fbc2a4e326148 Mon Sep 17 00:00:00 2001 From: Matt Jennings Date: Sun, 9 Jul 2023 10:52:23 -0500 Subject: [PATCH] adjust message box size, add message at end for suspicion --- src/actors/referee.ts | 2 +- src/classes/MatchScene.ts | 23 +++++++++++++++++++---- src/hud/message-box.ts | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/actors/referee.ts b/src/actors/referee.ts index 8c8b6df..279ea55 100644 --- a/src/actors/referee.ts +++ b/src/actors/referee.ts @@ -163,7 +163,7 @@ export class Referee extends BasePlayer { ) as BasePlayer[] if (nearbyPlayers.length) { - this.suspicion += nearbyPlayers.length * 0.1 + this.suspicion += nearbyPlayers.length * 0.5 nearbyPlayers.forEach((player) => { player.scare(player.pos.sub(this.pos).normalize()) }) diff --git a/src/classes/MatchScene.ts b/src/classes/MatchScene.ts index 58e8059..290e94c 100644 --- a/src/classes/MatchScene.ts +++ b/src/classes/MatchScene.ts @@ -12,7 +12,8 @@ import { Scoreboard } from '../hud/scoreboard' import { IcecreamTruck } from 'src/actors/icecream-truck' import { MessageBox } from 'src/hud/message-box' -export const SCORE_TO_WIN = 5 +export const SCORE_TO_WIN = 3 + export default class MatchScene extends ex.Scene { ball: Ball home: { @@ -193,7 +194,7 @@ export default class MatchScene extends ex.Scene { engine.add(new Scoreboard()) engine.add( new MessageBox( - 'You are a referee. Team Blue paid you to\nhelp them win. Do whatever it takes.\n\nPress Enter to start the game.' + 'You are a referee. Team Blue paid you to help them win.\nDo whatever it takes, first to 3 goals wins.\n\nPress Enter to start the game.' ) ) @@ -216,15 +217,29 @@ export default class MatchScene extends ex.Scene { assets.snd_crowdBLow.play() if (this.home.score >= SCORE_TO_WIN) { + let suspicionMessage = `Team Red didn't suspect a thing.` + + if (this.referee.suspicion > 30) { + suspicionMessage = `Team Red was a little suspicious...` + } else if (this.referee.suspicion > 50) { + suspicionMessage = `Team Red is outraged, but you told them\nto deal with it.` + } + this.gameHasStarted = false this.gameOver = true this.engine.add( - new MessageBox('Team Blue wins!\n\nPress Enter to play again.') + new MessageBox( + `Team Blue wins! ${suspicionMessage}\n\nPress Enter to play again.` + ) ) } else if (this.away.score >= SCORE_TO_WIN) { this.gameHasStarted = false this.gameOver = true - this.engine.add(new MessageBox('You lose.\n\nPress Enter to play again.')) + this.engine.add( + new MessageBox( + 'Despite your antics, Team Blue lost.\n\nPress Enter to play again.' + ) + ) } this.reset() diff --git a/src/hud/message-box.ts b/src/hud/message-box.ts index 21185af..f23c8d1 100644 --- a/src/hud/message-box.ts +++ b/src/hud/message-box.ts @@ -20,7 +20,7 @@ export class MessageBox extends ScreenElement { constructor(public message: string) { super({ x: 0, - y: 142, + y: 160, z: 99999, }) } @@ -29,7 +29,7 @@ export class MessageBox extends ScreenElement { const text = new ex.Text({ text: this.message, font: whiteFont, - scale: ex.vec(0.75, 0.75), + scale: ex.vec(0.5, 0.5), }) const bg = new ex.Rectangle({