Step 4: Creating Score Variable and First TIE-Fighter Collision 1

Goal:


Now that our TIE-Fighter can move, we need to tell it that it can run into other objects on the screen. We want to be able to destroy the TIE-Fighter when they are hit by a laser.

We also need variables to hold our current score and keep track of how many points we earn. We are going to create the variable first then start making the first of the TIE-Fighter Collision blocks.

Steps:

  1. In Variables, click on the button called “Make a Variable”.
  2. In the window that appears, type “Score”.
  3. From Control, place an IF statement block.
  4. From Sensing, place a touching mouse-pointer block, and set it to Red_laser.
  5. From Variables, place a change by block.
  6. Set the variable to Score and the amount to 1.

Code:


Click to replay
Click to replay