The following modifications have to be made to the game
class:
eng
field, which will store the instance of the engine
class.Field eng:engine
obj
. We will use this field during game setup.Field obj:ftObject
Field txtScore:ftObject Field txtFPS:ftObject
font1
object.Field font1:ftFont
Field layerBackGround:ftLayer Field layerGame:ftLayer Field layerTitle:ftLayer
sndBing
.Field sndBing:ftSound
atlas
field to store the sprite sheet for the atom elements.Field atlas:Image
Field score:Int = 0
fps
.Field fps:Int=0
gameMode
field, which will be initialized with the gmMenu
constant that we will add very soon.Field gameMode:Int = gmMenu
Field lastTime:Int Field deltaTime:Int
collCount
field.Field collCount:Int=0
true
so that we can act on it later on.Field isSuspended:Bool = False
Const gmMenu:Int = 1 Const gmPlay:Int = 2
Const grpAtom:Int = 3 Const grpCircle:Int = 4
In the game, we will use the timer feature of fantomEngine to change some values on an object. For this, we need a timer ID.
tmObjSwitch
timer ID.Const tmObjSwitch:Int = 5
Const btnPlay:Int = 10 Const btnReset:Int = 11 Const btnExit:Int = 12
3.15.156.140