- Zig 81.3%
- JavaScript 18.3%
- HTML 0.3%
| .idea | ||
| core | ||
| web | ||
| .DS_Store | ||
| .gitignore | ||
| build.sh | ||
| README.md | ||
Manhattan Skyline
Manhattan about 1930 as an etching: an endless parallax side-scroller under an aeroplane of the
time, flown left to right over the city and looped through hoops of balloons.
A different seed draws a different city: index.html#any-words.
Repository: https://git.peterscharmueller.com/tompeak/LOOPY
Controls
| Key | Does |
|---|---|
| ↓ | opens the throttle: thrust forward |
| ↓ + Shift | full throttle |
| ↑ | brakes, the throttle closed |
| ← | pulls the nose up; held, flies a looping, then another |
| → | pushes the nose down; held, flies a looping the other way, under |
Let go of everything and the plane holds its way and eases back to level, left to right. Let go over the top of a looping and it finishes the looping on its own, so it always comes out flying forward again.
Flying
The plane is flown on the forces on it, not steered like a cursor:
- Thrust pulls along the nose, drag holds it back, more the faster it goes.
- Gravity takes speed off it climbing and gives it back diving. A looping wants speed: open the throttle first, or it runs out of speed over the top.
- Lift comes from the wing meeting the air at an angle. ← and → swing the nose into the turn and the plane follows it round, sliding: its way lags the nose, the propeller pulls it across the curve, and the slide costs speed.
- Stall: too slow, or pulled too hard, and the wing gives out. The nose drops, it dives, and it flies again once it has its speed back.
- Near the top of the sky or down near the water the air bends its way back to level, softly, without taking its speed.
The view follows the plane forward only and never goes back, so over the top of a looping the plane draws its circle on the page while the city waits for it.
Score
Hoops of balloons hang along the city, each turned its own way, an arrow through it for the way it is to be flown. Some point up or down or backwards, and can only be flown partway round a looping.
| For | Points |
|---|---|
| a hoop flown through the way of its arrow | 100 × hoops in a row (100, 200, 300 …) |
| … flown in a looping | twice that |
| a looping | 50 × loopings in a row (50, 100, 150 …) |
A hoop passed by, or flown through against its arrow, breaks the row. Loopings are in a row while the plane keeps pitching round; flying straight again breaks it. The best score is kept in the browser.
Run
python3 -m http.server -d web 8000
then open http://localhost:8000. web/skyline.wasm is built and checked in, so nothing else
is needed.
Build the core
./build.sh # needs Zig 0.16 on the PATH, or ZIG=/path/to/zig ./build.sh
core/src/ is the Zig that decides every line: styles/manhattan.zig plans what stands where,
motifs/ draws towers, low blocks, the harbour, the sky; strip.zig cuts the strip into
stretches and plans a view with each thing's parallax speed. web/skyline.js paints each thing
once into a picture of its own, keeps it, and lays the pictures far to near onto a white sheet
multiplied onto the paper; it flies the aeroplane, hangs the hoops and keeps the score. See
core/NOTICE.md for the licence of the ported brush.
Thanks
The city is lifted from the maps engine of asimov-universes (https://github.com/wizard23/asimov-universes): its Manhattan strip style, the planner and the etched brush, nothing else. Many thanks to Philipp Tiefenbacher (https://github.com/wizard23) for it.
The brush, motifs and planner go back further, to {Shan, Shui}* by Lingdong Huang
(https://github.com/LingDong-/shan-shui-inf), MIT licensed; see core/NOTICE.md.