Fox Studios logo Fox StudiosGame projects, devlogs and Scratch builds
Projects

Building an Endless Runner in Scratch Over One Weekend

Last month I gave myself one rule: build an endless runner in Scratch between Friday evening and Sunday night, and share it no matter what state it was in.

Scratch editor showing a pixel runner character jumping over scrolling obstacles

Last month I gave myself one rule: build an endless runner in Scratch between Friday evening and Sunday night, and share it no matter what state it was in. The finished project has 11 sprites, 214 blocks in the main game loop, and a jump that took me longer to get right than everything else combined.

This is the project write up. If you want to build an endless runner in Scratch yourself, you can follow the same order I did, and you will probably skip the two mistakes that cost me most of Saturday afternoon.

Why an Endless Runner in Scratch Makes a Good Weekend Project

An endless runner has one core action, jumping, and one way to lose, hitting something. There are no levels to design, no story to write and no win screen. That makes the scope small enough to finish but deep enough to teach real lessons about timing, speed and fairness.

It also forces you to deal with things that matter in every game: gravity, collision, increasing difficulty and a score. If you have already worked through remaking a classic arcade game, a runner is a natural next step because it adds scrolling without the complexity of a full platformer.

The Weekend Plan

SessionGoalTime spent
Friday eveningPlayer sprite, ground, jump with gravity3 hours
Saturday morningObstacles that spawn and scroll2.5 hours
Saturday afternoonCollision, game over, restart3.5 hours
Sunday morningScore, speed increase, background parallax3 hours
Sunday eveningSound, title screen, playtest, share2 hours

Fourteen hours total. Saturday afternoon ran long, which is normal. Collision is where most small projects stall.

Getting the Jump to Feel Right

My first jump used a glide block: glide up 100 steps in 0.3 seconds, glide down in 0.3 seconds. It worked, and it felt terrible. The player hung in the air on a perfect triangle and landed like a lift arriving at a floor.

A good jump needs velocity and gravity. I made a variable called y velocity. When the player presses space and is touching the ground, set y velocity to 14. Every frame, change y by y velocity, then change y velocity by negative 1. When the sprite touches the ground color, set y velocity to 0 and nudge it back up until it is no longer overlapping.

Small tweaks that made a big difference

  • Gravity of 1.2 on the way down instead of 1 made landings snappier
  • Letting go of space early cut the jump short by halving y velocity, giving players control
  • A 4 frame grace window after leaving the edge of a platform still allowed a jump

That last one is often called coyote time, and players never notice it until it is missing.

Obstacles That Scroll Without Lag

The player never actually moves left or right. The world moves toward them. Each obstacle is a clone that starts at x position 260, just off the right edge, and changes x by negative speed every frame until it passes negative 260, when it deletes itself.

My first version spawned a new clone every 1.5 seconds on a fixed timer. The problem: as speed increased, gaps between obstacles shrank until jumps became impossible. The fix was spawning based on distance instead of time. A variable tracks how far the world has scrolled, and a new obstacle appears every 220 to 340 units, picked at random. Gaps stay fair no matter how fast the game runs.

Scratch has a limit of 300 clones. A runner never gets near that if clones delete themselves, but forgetting the delete step once gave me a game that slowed to a crawl after two minutes.

The Advice I Stopped Following

A lot of Scratch tutorials tell you to use "touching sprite" for every collision because it is pixel perfect. For a runner, that is exactly the problem. Pixel perfect collision means a single pixel of a cactus clipping the player's shoe ends the run, and players feel cheated.

I made an invisible hitbox costume for the player, a plain rectangle about 70 percent of the visible sprite's width. The player switches to the hitbox costume, checks collision, then switches back to the drawn costume, all inside one frame with run without screen refresh turned on. Playtesters stopped complaining immediately. Fairness beats precision in fast games.

Score, Speed and Knowing When to Stop

Score goes up by 1 every frame the player survives, displayed divided by 10 so the numbers do not climb absurdly fast. Speed starts at 6 and rises by 0.5 every 500 points, capped at 14. Without the cap, the game becomes unplayable around the four minute mark, which feels like a bug rather than a challenge.

I used cloud variables for an online high score, following the same pattern as in adding a score and high score to your Scratch game. It took twenty minutes and gave players a reason to try one more run.

On Sunday evening I stopped adding features. I had a list of six more ideas, including power ups and a double jump. None of them went in. The game was fun, it was finished, and shipping it mattered more than making it bigger.

What Five Playtesters Taught Me in One Hour

On Sunday evening I sent the project link to five friends and watched three of them play over a video call. Every one of them pressed the up arrow before trying space, so I added up arrow as a second jump key. Two of them died on the first obstacle because it appeared after only one second, so the first spawn now waits until the score reaches 30.

Nobody read the instructions on the title screen. I cut them to three words, "Space to jump", and moved the high score to the top corner where people actually looked. None of these changes took more than five minutes, and together they made the game feel twice as polished.

Frequently Asked Questions

How long does it take to make an endless runner in Scratch?

For someone comfortable with variables and clones, about 10 to 15 hours spread over a weekend. A complete beginner should allow two weekends and treat the jump and collision as separate learning sessions.

Why does my Scratch runner get laggy after a while?

Usually clones are not being deleted when they leave the screen, or a forever loop is creating new clones every frame. Add a delete this clone block when x position goes below negative 260 and check your spawn logic.

Should obstacles use clones or separate sprites?

Clones. One obstacle sprite with several costumes and a clone for each instance is far easier to manage than five separate sprites with copied scripts that drift out of sync when you edit one.

The Practical Takeaway

If you try this project, build the jump with velocity and gravity on day one, spawn obstacles by distance rather than time, and use a hitbox smaller than the art. Then set a hard deadline and share whatever you have when it arrives. More finished builds and write ups live in our projects section.

DF
Diego Fenn

Diego covers finished builds and the community around them, and runs the feedback threads that shape what the studio makes next.

More posts by Diego

More in Projects

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto