From 1de995864fdda525d7fb95a1313f847cacb47056 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 7 Jul 2024 02:56:52 -0500 Subject: add more levels --- levelSelect.js | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/levelSelect.js b/levelSelect.js index 5e734c2..9d45346 100644 --- a/levelSelect.js +++ b/levelSelect.js @@ -10,26 +10,47 @@ function buildLevel(x, y, t) { const levels = { 'initial jump': [ [], setupLevel([], [8, 0]) ], 'monopole harvesting': [ ['initial jump'], setupLevel([[3, 3]], [8,8]) ], - 'parabolic 0': [ ['initial jump', 'monopole harvesting'], setupLevel([[-2, 4], [0,0], [2, 4]], [3,9]) ], - 'sinusoidal': [ - ['initial jump', 'monopole harvesting'], - buildLevel(t => t-4, t => 4 * Math.sin(t), [...Array(8).keys()].map(x => Math.PI * x / 4)), + + 'parabolic 0': [ + ['monopole harvesting'], + buildLevel(t => t, t => t**2, [...Array(4).keys()].map(x => x)), ], 'parabolic 1': [ - ['parabolic 0'], - buildLevel(t => -0.5*(t-3)**2 + 4, t => t-3, [...Array(8).keys()].map(x => x - 2)), + ['monopole harvesting'], + buildLevel(t => t-2, t => t**2 - 2, [...Array(4).keys()].map(x => x)), ], - 'orbital': [ - ['parabolic 0', 'sinusoidal'], - buildLevel(t => 8*Math.cos(t), t => 8*Math.sin(t), [...Array(8).keys()].map(x => Math.PI * x / 4)), + 'parabolic 2': [ + ['monopole harvesting'], + buildLevel(t => t**2, t => t, [...Array(4).keys()].map(x => x)), ], - 'lissajous 0': [ - ['orbital'], - buildLevel(t => 8*Math.cos(3*t), t => 8*Math.sin(2*t), [...Array(8).keys()].map(x => Math.PI * x / 4)), + 'parabolic 3': [ + ['monopole harvesting'], + buildLevel(t => t-2, t => (t-2)**2, [...Array(4).keys()].map(x => x)), + ], + 'parabolic 4': [ + ['monopole harvesting'], + buildLevel(t => -0.5*(t-3)**2+1, t => t-4, [...Array(6).keys()].map(x => x)), + ], + + 'sinusoidal 0': [ + ['monopole harvesting'], + buildLevel(t => Math.sin(t), t => t, [...Array(6).keys()].map(x => 0.5 * Math.PI * x)), + ], + 'sinusoidal 1': [ + ['monopole harvesting'], + buildLevel(t => t-4, t => 4*Math.sin(t), [...Array(12).keys()].map(x => 0.25 * Math.PI * x)), + ], + '(co)sinusoidal 2': [ + ['monopole harvesting'], + buildLevel(t => t-4, t => 4*Math.cos(t), [...Array(12).keys()].map(x => 0.25 * Math.PI * x)), + ], + 'orbital': [ + ['(co)sinusoidal 2'], + buildLevel(t => 8*Math.cos(t), t => 8*Math.sin(t), [...Array(7).keys()].map(x => 0.25 * Math.PI * (x+1))), ], - 'lissajous 1': [ + 'spiral': [ ['orbital'], - buildLevel(t => 8*Math.sin(4*t), t => 8*Math.cos(3*t), [...Array(16).keys()].map(x => Math.PI * x / 8)), + buildLevel(t => 8*Math.cos(t)*t*0.1, t => 8*Math.sin(t)*t*0.1, [...Array(7).keys()].map(x => 0.3 * Math.PI * x)), ], }; @@ -39,10 +60,10 @@ export function setupLevelSelectUi(root, sfx) { const levelPicker = name => { const [ dependencies, level ] = levels[name]; const allDependenciesSatisfied = dependencies.map(x => levels[x][1].completed).reduce((acc, x) => acc && x, true); - if (allDependenciesSatisfied) { + // if (allDependenciesSatisfied) { + if (true) { sfx.listAppearAudio.currentTime = 0; sfx.listAppearAudio.play(); - // if (true) { const button = document.createElement('input'); button.type = 'button'; button.value = name; -- cgit v1.2.1