Step 8: Coding the Lightsaber On (Part 2)

Goal:


Now that we have the right block to build inside of and the IF statement to check if our lightsaber is turned off, we need to start telling the app what to do with that info.

First we need it to draw a line for use, but we need to tell the app some info about the line first.

Steps:

  1. From Variables, place a set block and make the variable saberON inside of the THEN portion of the IF block.
  2. From Logic, attach a false block to the end of the set saberOn block.
  3. From Canvas, place 2 set Canvas blocks. It doesn’t matter which one you pick as we are going to change their properties now.
  4. In the first set Canvas block, click the second window and select the one called LineWidth.
  5. In the second set Canvas block, click the second window and select the one called PaintColor.
  6. From Math, place 0(zero) block to the end of the set Canvas.LineWidth block, and change the number to 50.
  7. From Colors, attach any color you want to the end of the set Canvas.PaintColor block.

Code: