• No products in the cart.

Lesson 6: Events – Part 2 [Instructor] PRO

Review the concept of algorithm andwrite the first program

Lesson 6

Events Part2


Here are some questions that you can ask in review:

What did we do last time?

What do you wish we had had a chance to do?

Did you think of any questions after the lesson that you want to ask?

What was your favorite part of the last lesson?

Event.- An action that causes something to happen

Create buttons

Have a volunteer to touch any shape. If the volunteer touched the circle, the class clap one time. if he/she touched the rhombus the class tap the table. If he/she touched the square, the class stamp their feet. Show the following picture and ask them to say something every time you touch a shape

This is an illustration of a button, which is another type of event.

Every time you press a button, something happens.


Open the program events from last class

We are going to program some buttons

Add the following code illustrating the use of the buttons, the block for buttons is under the section Control

Here is the code for the full program in CoffeScript:

speed (100)

#Event: The code will run when something occurs

#Event: press the “up arrow” key

#Reaction: turtle moves up 10 steps

keydown ‘Up’, ->

fd 10

#Event: press the “down arrow” key

#Reaction: turtle moves down 10 steps

keydown ‘Down’, ->

bk 10

#Event: press the “left arrow” key

#Reaction: turtle turn left and moves 10 steps

keydown ‘Left’, ->


fd 10


#Event: press the “left arrow” key

#Reaction: turtle turn left and moves 10 steps

keydown ‘Right’, ->


fd 10


#Event: press the button grow

#Action: turtle grow 2 times

button ‘Grow’, ->

grow 2

#Event: press the button shrink

#Action: turtle size is reduced half size

button ‘Shrink’, ->

grow 0.5

#Event: press the button pen

#Action: pen is set with color and thickness

button ‘Pen’, ->

pen purple, 10

#Event: press the button “pen off”

#Action: pen is off

button ‘Pen off’, ->


Now the students can draw anything by using the events keydown and button.

NOTICE: For first grade you may only have time for two buttons .


Create one button that will make a box, one that will make a dot, one that will hide the turtle, and one that will show the turtle.

button ‘Grow’, ->

grow 3

button ‘Shrink’, ->

grow 0.5

button ‘Pen’, ->

pen purple, 10

button ‘Pen off’, ->


button ‘Box’, ->

box yellow, 50

button ‘Dot’, ->

dot green, 50

button ‘Hide’, ->


button ‘Show’, ->


Wrap Up

What is an event?

Why do we need to be able to handle events in a program?

Can we write any type of code for an event?

Last Updated:7/24/2019


SEE ALL Add a note
Add your Comment
Copyright © 2016-2018 Code Rev Kids, Inc. All Rights Reserved. Code Rev Kids, Inc. and kidslovecode.com are not official Minecraft® products. They are not approved by, or associated with Mojang®. NOT AN OFFICIAL MINECRAFT PRODUCT.  NOT APPROVED BY OR ASSOCIATED WITH MOJANG.


error: Content is protected !!