NEW Explore the Scratch Block Dictionary, tutorials, textbook, and classroom guides

Start learning →

How to Make a Side-Scrolling Platformer in Scratch (Camera X & Stomp)

📌 What you will learn

Code smooth Camera X horizontal scrolling, gravity jumps, solid wall collision, and enemy stomp detection using original sprites.

Camera X & Stomp Detection Pattern

Track worldX for every platform and enemy, render them at (worldX - camX), and check whether y velocity < 0 when touching an enemy to distinguish a stomp from side damage.

All 6 Popular Game Mechanics Explore more hit game systems. Learn more →
Scrolling & stomp core loop
  1. set [camX] to (camX + ((playerWorldX - camX) * 0.2))
  2. level & enemy sprites: set x to (myWorldX - camX)
  3. if touching [Enemy]? then if <y vel (0) then bounce & defeat else take damage

Try it: Smooth side-scrolling exploration with classic jump-on-top combat.

This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.