From 95ee8172ae99c00efbfb1c8c105112f82711ae01 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 7 Jul 2024 18:29:38 -0500 Subject: add level intro messages --- level.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'level.js') diff --git a/level.js b/level.js index 0d62adc..667013b 100644 --- a/level.js +++ b/level.js @@ -2,7 +2,7 @@ import { setupLevelSelectUi } from './levelSelect.js'; import { render } from './render.js'; -const X_START = '0'; +const X_START = 't'; const Y_START = 't'; const PATH_LEN = 20; @@ -12,10 +12,11 @@ const SLOW_RAMP = 1; const FAST_RAMP = 0.01; -export function setupLevel(resources, home) { +export function setupLevel(resources, home, intro) { const level = { resources: resources.map(position => ({ position, collected: false })), home, + intro: intro || null, running: false, completed: false, index: 0, @@ -149,6 +150,10 @@ export function setupLevelUi(level, root, sfx) { appearSound(); }, 500); + if (level.intro) { + setTimeout(() => showAlert(ui, level.intro), 600); + } + return ui; } -- cgit v1.2.1