Step 11

Goal:


Now we must program what happens if the Madalorian touches the keycard, baby yoda, or IG-11!

This will be similar to the touching color black code except we will now use touching (Sprite).

Steps:

  1. From Control, place 3 new IF statements for our color rules.
  2. From Sensing, drag over 2 touching blocks into the new IF statements.
  3. Select IG-11 for the first one, Keycard for the second one, and baby yoda for the third.
  4. Copy the code from touching color (black) into IG-11’s if statement.
  5. From Events, drag over 2 broadcasts into the last 2 IF statements.
  6. Create 2 new messages for the broadcast blocks: doorOpen for the first one, and yodaSaved for the second one.

Test out your game and see if your if statements are working for IG-11!

Code:


Click to replay