programextensions/scene/demos/voxels-fly.xtl
Voxels, 7: flying. The endless world of voxels-endless, now from the air: F switches between walking and flying. Flying moves level whatever you look at -- W forward, S back, A and D sideways -- Space rises and Shift sinks, with no gravity, the blocks still stopping you; so you can look down at the land as you cross it. F again drops you back to walking wherever you are. The columns are made ahead, one a frame, and dropped behind, under fog and a curved horizon. Run: just demo scene voxels-fly F fly or walk; flying: W A S D level, Space up, Shift down; walking: Space jump or swim up, Shift run; drag the mouse or the arrows to look, H: back to the start, q quit
s : ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, Int), (Int, Int, Int, Int), (Int, Int, Float, Int, Int))
the world around the start made before the first frame: each column takes three steps
s ← ᵉⁿn̲ew w
streamed : ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, Int), (Int, Int, Int, Int), (Int, Int, Float, Int, Int))
streamed ← (3 × (1 + 2 × ᵉⁿreach) × 1 + 2 × ᵉⁿreach) 'ᵉⁿs̲tream p̲ower s
ᵘf̲rame : (Num a, Num b, Num c, Num d) => ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, a), (b, Int, Int, Int), (Int, Int, Float, c, d)) -> ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, a), (b, Int, Int, Int), (Int, Int, Float, c, d))
one frame: an event, then a third of a column's work, then the player
ᵘf̲rame ← { s → ᵉⁿs̲topped s ? s v ← ˢᶜn̲ext! w ((v m̲atch "close") + (v m̲atch "key q") + v m̲atch "key Escape") > 0 ? ᵉⁿs̲top s stepped ← (v m̲atch "key f") ᵘf̲ly ᵉⁿs̲tream (v m̲atch "key h") ᵘi̲f s stepped ᵉⁿm̲ove ˢᶜc̲ontrols w }
ᵘi̲f : (Truthy a, Num b, Num c, Num d, Num e) => a -> ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, b), (c, Int, Int, Int), (Int, Int, Float, d, e)) -> ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, b), (c, Int, Int, Int), (Int, Int, Float, d, e))
ᵘi̲f ← { yes s → yes ? ᵉⁿh̲omeAgain s s }
ᵘf̲ly : (Truthy a, Num b, Num c, Num d, Num e) => a -> ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, b), (c, Int, Int, Int), (Int, Int, Float, d, e)) -> ((Float, Float, Float, Float, Float, Float), (Int, Int, Box Int, Box Int, Int, Int, Int, b), (c, Int, Int, Int), (Int, Int, Float, d, e))
ᵘf̲ly ← { yes s → yes ? ᵉⁿt̲oggleFly s s }