Understanding scrolling

In this section, we will go over how horizontal and vertical scrolling work conceptually and mathematically.

Engage thrusters

In a horizontal scrolling game, the player sprite is always visible, but the non-player sprites can move in and out of the stage. The non-player sprites in the Hunger Run game include the background sprites (such as bricks) and interactive sprites (such as food items). Even when a sprite moves in and out of the stage, it still exists in the game space. In a 2D scrolling game, the game space can be represented as 2D grids, which consists of 2D unit grids as shown in the following screenshot. Each grid unit is the same size as the stage, 480 pixels in length (L) and 360 pixels in width (W).

To keep the ...

Get Scratch 2.0 Game Development HOTSHOT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.