Bash.tv → GitHub → itch.io

Layered scrolling backgrounds that add depth. Parallax factors per layer, seamless horizontal and vertical tiling, auto-scrolling layers (clouds, runners), pixel-perfect scrolling without seams or shimmer, foreground layers over the player, depth tinting and fog, vertical parallax, layer sizes and performance, and parallax in Phaser (tileSprite), Pixi (TilingSprite) and three.js. Use for side-s...

Download skill (.zip) Files on GitHub

Parallax backgrounds

Canvas 2D (drop-in)

// layers far → near. factor 0 = fixed sky, 1 = moves with the world, >1 = foreground (in front of the player)
const LAYERS = [
  { img: images.sky,       factor: 0,    y: 0 },
  { img: images.mountains, factor: 0.2,  y: 40 },
  { img: images.clouds,    factor: 0.35, y: 10, auto: 12 },        // also drifts 12 px/s
  { img: images.trees,     factor: 0.6,  y: 120 },
];
const FOREGROUND = [{ img: images.grass, factor: 1.4, y: 250 }];
function drawLayers(ctx, layers, camX, camY, viewW, time) {
  for (const L of layers) {
    const w = L.img.width;
    let off = (camX * L.factor + (L.auto ?? 0) * time) % w;           // wrap
    if (off < 0) off += w;
    const x0 = -Math.round(off);                                       // integer: no shimmer or seams
    const y = Math.round(L.y - camY * (L.factorY ?? L.factor * 0.3));  // gentler vertical parallax
    for (let x = x0; x < viewW; x += w) ctx.drawImage(L.img, x, y);
  }
}
// render (screen space, before cam.apply): drawLayers(ctx, LAYERS, cam.left, cam.top, W, time)
// … world … then drawLayers(ctx, FOREGROUND, cam.left, cam.top, W, time)

Rules

Engines

Check

Scroll the full level width: no seams, gaps or jitter, the foreground never hides enemies or bullets, and it stays at 60 fps on phones (canvas-performance).