Step 18: Coding the Red Button

Goal:


Next let’s add the code for pushing the RedButton.

This code will set our the paint color of our Canvas to be Red. Come back to this code later if you want to make buttons for other colors as well!

Steps:

    1. Under the section labeled Blocks select RedButton.
    2. Grab and place the block labeled “when RedButton.Click”.
    3. Under Blocks select Canvas1.
    4. Grab and place the block labeled “set Canvas1.BackgroundColor”.
    5. Change “BackgroundColor” to say “PaintColor”.
    6. Under Blocks select Colors.
    7. Grab and place the Red block.

Code:


Click to replay