Step 6: Duplicate Collision Code and Make Changes

Goal:


Now that the TIE-Fighter can collide with the laser, we also want it to collide with the X-Wing. The code for this is almost identical to the code we just finished making so we are going to duplicate it and make minor changes to it.

Our code changes include what object the TIE-Fighter is sensing on screen, the X-Wing, and to lower our score instead of raise it.

Steps:

  1. Right-Click the IF statement block we just made, and select Duplicate.
  2. Now place this newly created code after the original IF statement block.
  3. Change the touching block in the new IF statement block to X_Wing.
  4. In the new change score by block, change the amount to -1.

Code:


Click to replay