O'Reilly logo

Scratch 2.0 Game Development HOTSHOT by Sergio van Pul, Jessica Chiang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required