Game Palette: Demos

Each demo is a small, working program that shows one part of Game Palette. The whole of each is in its page, so use your browser's "View page source" to read how it's done; the code is commented for reading. Each demo also links to the part of the manual that explains it.

Getting started

Simple sprite control
Load an animated image and move, turn, and scale a sprite with the keyboard. (see Skeleton)
Game flow: Star Catcher
A complete little game: loading, a title screen, playing, pausing, game over, and a best score, each a logic mode. (see Skeleton)
Timing
Logic steps, animation by the clock, and what happens when the computer can't keep up. (see desiredFPS)
Save and load
Save the game in slots and load it again, with a class and a renderer of the game's own. (see saveState)

The camera

Camera
Follow one sprite or two, tightly or loosely, looking ahead, and stopping at the edges of the level. (see The Camera)
Parallax
Depth and the perspective view: far scenery that's smaller and scrolls more slowly. (see Perspective)
Pixel art
A tiny canvas stretched with sharp pixels, the engine's smoothing, and a canvas that fills the window. (see smoothing)

Drawing

Fill renderers
The tile, horizontal, and vertical fill renderers, with a sprite and camera to move and turn. (see Endless backgrounds)
Custom renderers
Renderers of your own: shapes with no image, a health bar, a shadow, and an endless grid. (see Writing your own renderer)
Animation
A knight who walks and attacks, with image triggers for footsteps and blows, and an explosion that ends itself. (see Triggers)

Sound

Audio mixer
Every sound setting, with controls to try them and a list of the calls made. (see Sounds)
Sound triggers
An introduction that starts the music's loop, and lights that flash on the beat. (see Sound triggers)

Input

Keyboard
Controls with several keys, keys pressed once and held, even diagonal movement, and choosing your own keys. (see User Input)
Mouse and touch
Click or tap to walk there, with the point turned into game coordinates however the camera is turned. (see Mouse and touch)

Add-ons

Linked sprites
A robot whose parts follow its wheels, with the LinkedSprite add-on. (see LinkedSprite)
Checkerboard map
Walk round a map drawn from a grid of tiles, with the CheckerboardMap add-on, kept off the tiles that aren't passable. (see CheckerboardMap)
Writing add-ons
Two add-ons of the page's own: the manual's Mover, and a debugging overlay. (see Writing your own add-on)

Game Palette