In the background screen, you will see a grid for all the gems. On the right side of the grid, you will also see the current score displayed, along with the time which is remaining to play this game.
1. Insert a new method called
CreateBackgroundScreen
into thegame
class.Method CreateBackgroundScreen:Int ()
2. Set the default layer for this method.
eng.SetDefaultLayer(layerBackground )
3. Start two new FOR loops—one for the rows (x) and one for the columns (y).
For Local y:Int = 1 To rows For Local x:Int = 1 To columns
In the next few pages, you will see the integer value
64
used many times. It is the length of the edge of all sprites that we will load.4. Now, load the grid sprite from the atlas image. The position will be set depending on the
x
andy
values. Close both FOR loops.Local obj := eng.CreateImage(atlas,0,0,64,64,x*64,y*64) Next Next
5. Next, add two text objects. One for the score and one for the time.
Local tx1 := eng.CreateText...