To store data in Treasure chest, we will add some fields to the game
class.
Class game Extends App Field eng:engine Field isSuspended:Bool = False Field cw:Float Field ch:Float
Field gameMode:Int = gmTitle
Field minutes:Int Field seconds:Int
Field endTime:Int
Field score:Int = 0
2000
milliseconds. This makes it easy for testing.Field gameTime:Int = (1000*60*2)
Field rows:Int = 6 Field columns:Int = 7
Field tileMap:Int[][]
Field firstTile:ftObject=Null Field secondTile:ftObject=Null
Field selector:ftObject=Null
Field justStarted:Bool=False
Field atlas:Image
Field font1:ftFont
Field txtScore:ftObject Field txtTime:ftObject Field txtFinalScore:ftObject
10
objects. Each one reassembles one entry in the list.Field txtHighScore:ftObject[10]
Field sndSelect:ftSound Field sndExplo:ftSound Field sndFalse:ftSound
Field layerBackground:ftLayer Field layerGame:ftLayer Field layerGFX:ftLayer Field layerGameOver:ftLayer Field layerMenu:ftLayer Field layerScore:ftLayer Field layerTitle:ftLayer
Those were all the fields we need. Now, let's add some constants.
Const gmTitle:Int = 1 Const gmMenu:Int = 2 Const gmPlay:Int = 4 Const gmGameOver:Int = 5 Const gmScore:Int = 7
Const btnPlay:Int = 11 Const btnScore:Int = 12 Const btnExit:Int = 13 Const btnBack:Int = 14
Const triDelete:Int = 21
Const tmShowMenu:Int = 31 Const tmObjRemove:Int = 32
Const strTitle:String = "Treasure Chest" Const strVersion:String = "1.0" Const strAuthor:String = "YOU" Method OnCreate:Int()