The Treadmill
Every endless runner you've played is a lie, and it's a good one.
The hero isn't going anywhere. They stay in the same column, frame after frame. It's the world that slides past — ground, trees, obstacles, all moving left while the hero jogs on the spot.
Once you see it you can't unsee it, and it makes the game far easier to write. A hero that never moves can never run off the edge, and a world made of numbers can go on forever.
The whole trick
Marks every fourth column — and because t grows each frame, the pattern slides
one column left every time. There is no list of ground tiles. There is a
formula, and a clock.
Parallax: distance for free
Real distance has a side effect: far things appear to move slower than near things. Copy it and a flat picture suddenly has depth.
t // 3 is whole-number division — it only changes every third frame, so that
layer crawls. Draw the far layer higher up and the near layer along the ground,
and your eye reads it as a horizon.
This is called parallax, it costs one extra division, and it is the single cheapest way to make a 2D scene look like it has depth.
Things that come towards you
Obstacles are just numbers that get smaller:
Each rock is a column. Every frame it moves one to the left. When it passes the left edge it reappears on the right — the same recycling you did with raindrops in Chapter 5, turned on its side.
Three rocks, reused forever, and the player believes the world is endless.