From 8c075b25b02b4a731e6a02691a00a4c7bb829942 Mon Sep 17 00:00:00 2001 From: kts of kettek Date: Sun, 30 Jan 2022 16:09:05 -0800 Subject: [PATCH] Accelerate time when all entities are dead --- Engine/src/states/Game.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Engine/src/states/Game.ts b/Engine/src/states/Game.ts index 2c659bf..e0b854b 100644 --- a/Engine/src/states/Game.ts +++ b/Engine/src/states/Game.ts @@ -350,6 +350,14 @@ export function GameState(ctx: ContextI, selectedAnimal: string, selectedSegment updateGameOver() } } else { + // If it's just the player at night, accelerate time. + if (entities.filter(v=>v instanceof AnimalEntity).length === 1) { + if (isNight) { + modeTimer += realDelta * 4 + } else { + modeTimer += realDelta + } + } // Update clock { //clockContainer.width = ctx.app.renderer.width @@ -689,6 +697,8 @@ export function GameState(ctx: ContextI, selectedAnimal: string, selectedSegment } } + nightTime = (30+daysSurvived) * 1000 + dayTime = (30-daysSurvived) * 1000 } nightfall(false)