Step 13: Coding the Lightsaber Off (Part 2)

Goal:


We now need to check to see if our lightsaber is actually on our not before we turn it off.

Steps:

  1. From Control, place an IF/THEN block inside of the THEN position of the previous IF/THEN block we just placed.
  2. From Variables, attach a get block into the IF portion of the IF/THEN block and set it to saberOn.
  3. From Variables, place a set block inside of the THEN portion of the IF/THEN block, and set it to saberON.
  4. From Logic, attach a false block to the end of the set saberOn block.
  5. From Canvas, place a clear block.
  6. From saberOff, place a Play block.
  7. From saberOff, place a Vibrate millisecs block.
  8. From Math, attach a 0(zero) to the end of the Vibrate millisecs block and set it to 500.

Code: