diff options
author | sanine <sanine.not@pm.me> | 2024-07-06 21:24:04 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2024-07-06 21:24:04 -0500 |
commit | c012fec2870757990080e823d42dd91031e64f25 (patch) | |
tree | fa5863939b883c0cf301cda333777cd543f350a1 /levelSelect.js | |
parent | 03528a25215330d3b00cabdb1bbe7ce701e1bfeb (diff) |
set rocket to relatively constant velocity
Diffstat (limited to 'levelSelect.js')
-rw-r--r-- | levelSelect.js | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/levelSelect.js b/levelSelect.js index 2fe3d52..238639c 100644 --- a/levelSelect.js +++ b/levelSelect.js @@ -1,18 +1,37 @@ import{ setupLevel, setupLevelUi } from './level.js'; + +function buildLevel(x, y, t) { + const ts = t.slice(0, -1); + const tf = t[t.length-1]; + return setupLevel(ts.map(T => [ x(T), y(T) ]), [ x(tf), y(tf) ]); +} + const levels = { '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]) ], + 'parabolic 0': [ ['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)], - [1.0*Math.PI - 4, 4*Math.sin(1.0*Math.PI)], - [1.5*Math.PI - 4, 4*Math.sin(1.5*Math.PI)], - ], [2.0*Math.PI - 4, 4*Math.sin(2.0*Math.PI)]), + buildLevel(t => t-4, t => 4 * Math.sin(t), [...Array(8).keys()].map(x => Math.PI * x / 4)), + ], + 'parabolic 1': [ + ['parabolic 0'], + buildLevel(t => -0.5*(t-3)**2 + 4, t => t-3, [...Array(8).keys()].map(x => x - 2)), ], + 'orbital': [ + ['parabolic 0', 'sinusoidal'], + buildLevel(t => 8*Math.cos(t), t => 8*Math.sin(t), [...Array(8).keys()].map(x => Math.PI * x / 4)), + ], + '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)), + ], + 'lissajous 1': [ + ['orbital'], + buildLevel(t => 8*Math.sin(4*t), t => 8*Math.cos(3*t), [...Array(16).keys()].map(x => Math.PI * x / 8)), + ], + }; export function setupLevelSelectUi(root, sfx) { |