From 03528a25215330d3b00cabdb1bbe7ce701e1bfeb Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 6 Jul 2024 20:16:48 -0500 Subject: implement level loading animation --- levelSelect.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'levelSelect.js') diff --git a/levelSelect.js b/levelSelect.js index 0fbdbf0..2fe3d52 100644 --- a/levelSelect.js +++ b/levelSelect.js @@ -1,11 +1,11 @@ import{ setupLevel, setupLevelUi } from './level.js'; const levels = { - 'Initial Jump': [ [], setupLevel([], [8, 0]) ], - 'Monopole Mining': [ ['Initial Jump'], setupLevel([[3, 3]], [8,8]) ], - 'Parabolic': [ ['Initial Jump', 'Monopole Mining'], setupLevel([[-2, 4], [0,0], [2, 4]], [3,9]) ], - 'Sinusoidal': [ - ['Initial Jump', 'Monopole Mining'], + 'initial jump': [ [], setupLevel([], [8, 0]) ], + 'monopole harvesting': [ ['initial jump'], setupLevel([[3, 3]], [8,8]) ], + 'parabolic': [ ['initial jump', 'monopole harvesting'], setupLevel([[-2, 4], [0,0], [2, 4]], [3,9]) ], + 'sinusoidal': [ + ['initial jump', 'monopole harvesting'], setupLevel([ [-4, 4*Math.sin(0)], [0.5*Math.PI - 4, 4*Math.sin(0.5*Math.PI)], @@ -44,7 +44,15 @@ export function setupLevelSelectUi(root, sfx) { } } - [...Object.keys(levels)].forEach(levelPicker); + let time = 0; + [...Object.keys(levels)].forEach(name => { + setTimeout(() => { + sfx.listAppearAudio.currentTime = 0; + sfx.listAppearAudio.play(); + levelPicker(name); + }, 100 * time + 100) + time += 1; + }); const header = document.createElement('h1'); header.classList.add('center'); header.innerText = 'AVAILABLE CONTRACTS'; -- cgit v1.2.1