Game Palette: Parallax demo

This browser does not support HTML5 canvas; it is required to use the Game Palette library

Use WASD/arrow keys to fly the UFO; the camera follows it. Z and X move the UFO farther away or nearer, so it can fly behind the trees and over the hills.

I and K truck the camera in and out (cameraZ). J and L change the focal length: shorter is a wider, deeper view. U and O turn the camera, and Space puts the camera back.

Every sprite here is flat, and each has a z (depth). With the engine's perspectiveView on, a sprite at depth z is drawn at focalLength / (z - cameraZ + focalLength) times its size, so farther sprites are smaller and scroll by more slowly. The mountains are at z = 4000, the hills 1800, the ground 700, the trees 900 and 200, the UFO 0, and the grass -400, in front of the UFO.