

Temp1, temp2, temp3: Temporary variables. Wait: How long to wait before tap instruction animation starts showing after death LastPipeScored: To validate if we already awarded a score to player for passing through current pipe so we don’t score multiple for the same pipeįirstGame: Indicates if it is the first game ever IsNewBest: Checks if the current score is higher than best score State: Indicates current state of the game, can be either READY or RUNNING. UpDown: Indicates if the copter is moving up or falling down. Random order so that player doesn’t learn the pattern and the game stays challenging in each play.Īctive_pipes: Pipes that haven’t crossed the left edge of the screen yet. Heights: This holds values from ALL_HEIGHTS variable that we showed above but in random order. Note we do not make the copter move, we instead make the pipes move.ĭB_SCORE_TAG: This is a tag to use for storing a score and also reading a saved score. SPEED: How fast pipes should move leftwards. This should be defined considering screen width so that in various screens, difficulty stays the same You can make the gap even bigger to make the game easier.

Four times of the copter width should be ok and challenging. We have to make sure there’s enough gap for our copter to fit and able to move horizontally before another pipe appears. PIPE_GAP: Indicates horizontal gap between two pipes as shown in the image above. READY: If in idle state, this indicates waiting for player to tap and start the game RUNNING: Indicates if player started playing the game (not in idle or end state) I will explain what they are for, in a bit. Now, let’s define some variables that we’ll need throughout the game. Lastly, we have some Sound effects for flapping/spinning, scoring, death, and hit sound. For some, we want them to fire more frequently than others.ĥ. Important thing to notice here is the value of TimerInterval property of these clocks are set to different values. Later in the tutorial as we’d use them, it will become obvious which is for what purpose. We also have different Clock components – for copter’s flap/spin animation, tap instruction animation, clocks for copter to go up and down, etc. All these tiny effects and details make gameplay more exciting and entertaining.Ĥ. This Flash image sprite is to show a quick white flash (death impact) when the player hits an obstacle and dies. We have various ImageSprite components for our copter, green pipes like obstacles, for showing header and tap instruction animation, and a Flash. It’s very important that you name different components with some meanings or purpose so that later you can easily recognize what they are for.ģ. Font size is set to 22 to display scores.Ģ. We have the following components in Screen1 :ġ. A Canvas component which we renamed to GameCanvas with Height and Width both set to 100% to take the entire device screen.
