Log inGet started
World

Pixel Ledges: 2D Platformer Kit with Sprites, Tilemaps, Wall Jumps and Dash

README.md

backgrounds

Paints the twoDKit's fourteen parallax backgrounds and saves them as art assets. Each background is four 320x180 layers: sky, far, mid and near. Each one is a repeating, nearest-filtered texture with a parallax-shader material. Run it again whenever the art code changes. It writes to art/backgrounds/.

local Backgrounds = require("twoDKit.artgen.backgrounds")
Backgrounds.generate()            -- all fourteen
Backgrounds.generate("castle")    -- one
local layers = Backgrounds.paint("snow")   -- { sky, far, mid, near } canvases, not saved
print(Backgrounds.info.snow.skyTop)        -- "#070b1f"

Exports

  • ids: grassland, cave, castle, lab, snow, desert, volcano, jungle, coast, crypt, sky, factory, candy, autumn.
  • info[id] = { skyTop, skyBottom }: hex colours of the sky layer's top and bottom rows. Use them for a clear colour or to fill above and below the band.
  • generate(id?) paints and saves textures <id>_<layer> (identity twoDKit.art.backgrounds.<id>_<layer>) and same-named materials. It returns the texture paths.
  • paint(id) returns the four canvases without saving them, for previews.

Layer rules

  • sky is fully opaque. Its top row is one flat colour, so the parallax shader's stretch mode extends it cleanly.
  • far, mid and near use cut-out alpha: every pixel is either alpha 0 or alpha 255. Their content sits in the lower ~55%, ~45% and ~35% of the image. Their bottom row is solid, so stacked layers leave no holes.
  • Every layer tiles seamlessly: column 319 continues into column 0. Shapes are drawn through wrapping helpers, and the noise used is periodic.
  • Layers get darker, more saturated and more detailed toward the camera. Far layers are hazed toward the horizon colour. Values stay below where the matching tile sets sit, so the level reads in front.

The fourteen scenes

  • grassland: afternoon sky with sun and cumulus clouds, snow-capped blue ranges, rolling green hills with copses, and a dark forest edge.
  • cave: a dark cavern ceiling with stalactites, glowing hanging roots and distant columns, then crystal-lit stalagmites, mossy rock pillars, and foreground rock with big cyan and magenta crystals.
  • castle: dusk gradient with a crescent moon, stars, a setting sun and lit cloud streaks, a distant fortress on a crag, a crenellated curtain wall with banners and pennants, and a torch-lit parapet.
  • lab: a dark facility wall with a giant reactor ring, light cones and cyan column strips, then machinery silhouettes, server racks, monitors and pipe runs, and foreground pipes, valves and hazard-striped consoles.
  • snow: night sky with aurora curtains, moon and stars, moonlit snowy peaks, snowy hills with small pines, and a pine forest on a snowbank.
  • desert: hot sunset with a banded sun disc, birds and cloud streaks, hazy mesas, striated buttes, and dark rim-lit dunes with saguaro cacti.
  • volcano: an ember sky under ash clouds lit from below, an erupting cone with lava rivulets and a plume, basalt column clusters standing in a glowing lava river, and black jagged rock with glowing fissures and sparks.
  • jungle: green mist with slanting sun shafts and a misty canopy, a stepped temple rising out of a hazy forest, tall rainforest trees hung with lianas and vines, and dark undergrowth with big fern fronds.
  • coast: a bright tropical sky with sun and cumulus, a turquoise sea to the horizon with sparkles, a far island and a sail, rose coral sea stacks with palms in a shallow lagoon, and a sandy beach with big palms and dune grass.
  • crypt: a violet night with a full moon, cloud streaks and bats, a haunted manor and chapel on a hill with lit windows, gnarled dead trees and graves in rising fog, and an iron cemetery fence with tombstones in ground fog.
  • sky: a sunrise gradient with a low sun, glowing cloud streaks and pink cumulus, hazy floating islands over a distant cloud sea, big grassy floating islands with trees, hanging roots, waterfalls and a marble ruin, and a sunlit sea of clouds up close.
  • factory: a smog-orange dusk with a dim sun behind smog bands, a skyline of smokestacks, sheds and cooling towers trailing smoke, a sawtooth-roofed works with lit windows, banded chimneys, a gas holder and a gantry, and a chain-link fence with storage tanks and a pipe run.
  • candy: a pastel sky with a rainbow, sparkles and cotton-candy clouds, chocolate peaks under pink icing, mint gumdrop hills sprinkled with dots under lollipop trees, and frosted cake ground with drips, giant candy canes and gumdrops.
  • autumn: a dusk sky with a harvest moon, stars, a flight of geese and cloud streaks, misty hills crowned with woods and a farm with a lit window, a blazing canopy of orange, red and gold trees, and bare twisted trees, a split-rail fence, leaf litter and falling leaves.