5 Rename Layout and Event Sheet
6 Rename Layer 0 to Background
7 Add a Sprite, call it Background
8 Load all frames from Assets - Background Folder (Ctrl A to select all)
9 Select your Layout in Project View (RIGHT)
10 Adjust settings on LEFT
11 Change the origin of the background tile to TOP LEFT
Apply to the WHOLE ANIMATION (right click origin)
12 Select Background in Project view
Set the initial frame to the animation number you want your background colour to be ( eg 0 for grey, 1 for brown etc)
13 Snap first Background block to position 0,0
14 Duplicate 15 squares across (Select sprite, Hold Ctrl, left click, drag and release)
16 Select your background:
17 Add two instance variables and name them StartX and StartY
18 Add a new Event Sheet, name it Background
19 Code the Background Event Sheet
Note that the last event in this code snippet is found in SYSTEM --> COMPARE X
Record starting x and y position of each block.
Move each block diagonally up and left.
Once block moved 64 pixels left
Move it back to it's original position.
20 Include the Background Event Sheet in Level 1 Event Sheet (Right click in Level 1 event sheet, include Background event sheet)
Game Development Theory - Modular Code for Re-use
Now we have encapsulated the data for the background.
We can include the background event sheet in any level.
We can change the initial frame to have a different background.
21 Lock the background layer so that we do not move it by accident.