Game Maker Tutorial

Page 4 of 13
Scrolling backgrounds
A scrolling shooter thanks its name to the fact that the game world scrolls over the screen, normally either from top to bottom or from right to left. This gives the illusion of motion. In the game 1945 the game world scrolls vertically. Even though the plane the player controls actually stands still on the screen you get the impression as if it flies over the scrolling background.
You can control the position of the plane by moving it around on the screen. This gives the impression of the plane speeding up, when it moves forwards, or slowing down when it moves backwards. It is crucial that the plane does not move faster backwards than the background scrolls. This would give the illusion that the plane flies backwards, which is of course impossible.
So how do we create a scrolling background in Game Maker? There are actually two possibilities. The first and easiest possibility is to use a tiling background image that moves downwards through the room. The second, more complicated, way is to build a much larger room but only show part of the room using a so-called view. This view slowly moves upwards over the room. We will start with using a moving background. Later we will briefly investigate the second option.
As our game takes place over the see we need a background image that looks like a see viewed from above. We add the following small image as a background resource to the game and give it the name back_water:
Filling the background with it will give a nicely looking sea. To create a room with a moving background, add a room to the game in the familiar way. At the left click on the tab labeled backgrounds. We need to change three settings here.
First of all, because we are going to fill the whole room with the background image we do not need to draw the background in a color, so uncheck the box labeled Draw background color. Second, in the middle click on the menu icon and select the back_water background image. The default setting is to tile the whole room with it so this is what we want. Finally, we need to make the background move. To this end, at the bottom, set the Vert. speed to 2. The form should now look as follows.
Run the game to verify that we indeed have a scrolling background that gives the illusion of motion.