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.
Scrolling & stomp core loop
- set [camX] to (camX + ((playerWorldX - camX) * 0.2))
- level & enemy sprites: set x to (myWorldX - camX)
- 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.