Time for action — creating the data structure
To store the data, we will enhance the
game class with some fields and constants, as follows:
- First, add two text objects that will display the scores of the player and the computer.
Class game Extends App
Field isSuspended:Bool = False
- Next, add two text objects that will display if the player wins or loses.
- The player plane and the enemy plane will be stored in separate objects.
- The game font also has to be stored.
- Now, add five layers for the background, the game and clouds, and also the information and the title screen.