In this lesson, we will learn about events and event handlers, which are important concepts in computer science and can be found in all programming languages. We will start with a fun
unplugged activity that demonstrates cause and effect, and how events trigger actions in the real world. Next, we’ll get hands-on with MakeCode, and finally, we’ll challenge you to create your own MakeCode projects that use events to activate different parts of your program.
Guiding ideas for Programming with Minecraft
Lesson 2 of Intro to CS with MakeCode An “event” in computer science is an action or occurrence that is detected by a computer. For example, when someone clicks the button on their mouse, it generates a “mouse click event” for the computer. In real life, there are also events that may be associated with a following action, like Cause-and-Effect.
Student activities in Programming with Minecraft
• Unplugged Activity: Events and Handlers. Reinforce event-driven programming model by having students act out paired events and resulting actions.
• Activity: Yellow Brick Road. Configure an event handler to cause something to happen when a player is walking.
• Activity: Sing a Song of Sixpence. In this activity, students will take inspiration from this old English nursery rhyme to recreate this in Minecraft.
• Activity: Last Stand. Use code to recreate the experience of being overrun by hordes of zombies to demonstrate the effect of exponential growth.
• Independent Project. On their own, students choose one or more of the provided event handler blocks to trigger different actions or results.
For their independent projects, students should compose a diary entry addressing the following:
• What kind of event and event handler did you decide to use?
• What does your program do? Describe how your program works (what is the cause-and-effect)
• Include at least one screenshot of your program working
• Share your project to the web and include the URL here