Time for action — creating the data structure
To store data in Treasure chest, we will add some fields to the
- First, start with two FLOAT variables, which will hold the size of the canvas.
Class game Extends App
Field isSuspended:Bool = False
- Next, add a field to store the mode of the game. Initialize it with a constant, which we will define shortly.
Field gameMode:Int = gmTitle
- During the game, we need to measure how much time is left. For this, we need a field for minutes and one for seconds.
- When a game begins, we need to store the time in milliseconds, to check when it will end.
- Add a field for the game score.
- The ...