Pixel Ledges: 2D Platformer Kit with Sprites, Tilemaps, Wall Jumps and Dash
README.md
characters
Generator for the kit's twelve playable character sprite sheets: knight, robot, fox, mage, ninja (masked, long red scarf, katana on the back), astronaut (bubble helmet with a gold-rimmed visor, life-support pack with a blinking whip antenna, thruster puffs on take-off and dash), frog (big eyes on top of a wide head, webbed feet, pink bandana, dizzy eyes and tongue out when hurt), pirate (tricorn hat, eyepatch, beard, long coat tails, cutlass), skeleton (bone limbs, ribcage, glowing green eye lights, a clacking jaw, tattered cloak, femur club), viking (stocky, horned iron helm, braided ginger beard, quartered round shield on the back, bearded axe), slime (a limbless pink jelly blob in a gold crown, painted whole by drawBody: it squashes, stretches and hops, smears against walls and drips goo) and bird (round bluebird with a crest, goggles and a beak, wings drawn by drawWing in place of arms so they flap up on jumps). It paints each one in code with twoDKit.paint and saves it as a nearest-filtered texture plus a twoDKit.sprite material under twoDKit.package/art/characters/<id>.
local Chars = require("twoDKit.artgen.characters")
Chars.generate() -- all twelve
Chars.generate("fox") -- one
local canvas = Chars.sheet("mage") -- paint without saving (previews)
Exports: ids, rows (animation table), generate(id?), sheet(id).
Sheet format
256x256, an 8x8 grid of 32x32 frames, frame (col, row) at pixel (col32, row32) from the top-left. The character faces right, feet on y = 31, body centred on x = 16. The core body is about 12 px wide (x 11..22) and 23 px tall (y 8..31). The plume, hat, antenna, ears, tail, cape and effects reach further. Unused frames are transparent.
| row | anim | frames | fps | loop |
|---|---|---|---|---|
| 0 | idle | 6 | 8 | yes |
| 1 | run | 8 | 14 | yes |
| 2 | jump | 3 | 12 | no, hold last |
| 3 | fall | 3 | 10 | frame 0 once, then loop 1..2 |
| 4 | wallSlide | 3 | 10 | yes; the wall is on the character's RIGHT and the character faces away from it (left) |
| 5 | dash | 4 | 20 | no |
| 6 | land | 3 | 16 | no, then idle |
| 7 | hurt | 2 | 10 | no |
How it is painted
Each frame is a pose on a small rig: two-bone IK legs and arms are drawn as shaded capsules, and the heads and torsos are hand-authored ASCII sprites. Capes, tails, scarves, plumes, hat tips and antennas are chains pushed by a per-pose "wind" vector and swayed by a travelling wave. Each depth layer (cloth/tail, far limbs, body, head, near arm/held item) gets its own coloured 1 px outline, so limbs separate cleanly. Light comes from the top-left, and far limbs drop one step down their ramp. Dust, sparks, speed streaks, the dash afterimage and hurt stars are drawn last, without an outline. All pixels are fully opaque or fully transparent, which the cutout sprite material needs.
To add a character, add a CH.<id> constructor (palette ramps, drawBack, drawTorso, drawHead, and optionally drawOverLegs, drawHeld and drawFrontArmPost), then add the id to ids.