Introduction to Computer Science with MakeCode for Minecraft

Similar documents
Microsoft MakeCode for

Introduction to Computer Science with MakeCode for Minecraft

Microsoft MakeCode for

Quest 6: Viking Mythology

Introduction to Computer Science with MakeCode for Minecraft

Introduction to Computer Science with MakeCode for Minecraft

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

Minecraft Hour of Code Adventurer: Answer Sheet & Teacher Tips

How to Survive Your First Night in Minecraft

Single Player Orientation

Quest 1: Viking Roles

Kodu Game Programming

LESSON 1 CROSSY ROAD

G54GAM Lab Session 1

Creating Journey In AgentCubes

A Teacher s guide to the computers 4 kids minecraft education edition lessons

Before displaying an image, the game should wait for a random amount of time.

EFFORT EMPATHY GROWTH

Background. After the Virus

Adding in 3D Models and Animations

WHAT IS MINECRAFT? source:

Getting Started with Osmo Coding Jam. Updated

Addendum 18: The Bezier Tool in Art and Stitch

1. Creating geometry based on sketches 2. Using sketch lines as reference 3. Using sketches to drive changes in geometry

Sketch-Up Project Gear by Mark Slagle

An Introduction to ScratchJr

Introducing Scratch Game development does not have to be difficult or expensive. The Lifelong Kindergarten Lab at Massachusetts Institute

Introduction to Turtle Art

Ask Jo: Quilt Designing on the Computer

In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

Happiness & Attitude. Kids Activities

CONCEPTS EXPLAINED CONCEPTS (IN ORDER)

SAVING, LOADING AND REUSING LAYER STYLES

Overview. The Game Idea

Spell Casting Motion Pack 8/23/2017

Making Your World with the Aurora Toolset

Use Linear Regression to Find the Best Line on a Graphing Calculator

Introduction Installation Switch Skills 1 Windows Auto-run CDs My Computer Setup.exe Apple Macintosh Switch Skills 1

CIDM 2315 Final Project: Hunt the Wumpus

Would You Like To Earn $1000 s With The Click Of A Button?

Your First Game: Devilishly Easy

Kodu Lesson 7 Game Design The game world Number of players The ultimate goal Game Rules and Objectives Point of View

15 TUBE CLEANER: A SIMPLE SHOOTING GAME

- Introduction - Minecraft Pi Edition. - Introduction - What you will need. - Introduction - Running Minecraft

Activities for Eye Gaze. manual

Lesson 1 Getting Started. 1. What are the different ways you interact with computers?

CS 251 Intermediate Programming Space Invaders Project: Part 3 Complete Game

MATHEMATICAL RELATIONAL SKILLS AND COUNTING 0 20

Starting from LEARNER NOTES edited version. An Introduction to Computing Science by Jeremy Scott

2D Platform. Table of Contents

Instruction Manual. Pangea Software, Inc. All Rights Reserved Enigmo is a trademark of Pangea Software, Inc.

Cato s Hike Quick Start

NWN Toolset Module Construction Tutorial

THE UGLY DUCKLING. Teachers' notes.

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

The VBA will have such a set of files available on the VBA Bridge Resource CD for some major systems. Guess where you can get a copy

GAME:IT Junior Bouncing Ball

VACUUM MARAUDERS V1.0

Rhyme Time. Look at that cat! It has a hat!

Getting Started with Osmo Coding. Updated

Your EdVenture into Robotics 10 Lesson plans

The horse image used for this tutorial comes from Capgros at the Stock Exchange. The rest are mine.

Code Kingdoms Sandbox Guide

Speaking Notes for Grades 4 to 6 Presentation

READ THIS FIRST, IF YOU HAVE NEVER PLAYED THE GAME BEFORE! World of Arch, First Days of Survival F.A.Q.

Okay, that s enough talking. Let s get things started. Here s the photo I m going to be using in this tutorial: The original photo.

LESSON ACTIVITY TOOLKIT 2.0

The light sensor, rotation sensor, and motors may all be monitored using the view function on the RCX.

Walkthrough of Lust Man Standing

Solo Mode. Chords Mode

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell!

COMPOUND EVENTS. Judo Math Inc.

1. Create a 2D sketch 2. Create geometry in a sketch 3. Use constraints to position geometry 4. Use dimensions to set the size of geometry

COMPUTING CURRICULUM TOOLKIT

Listen to the narrator and follow his advice and prompts throughout the game.

micro:bit for primary schools mb4ps.co.uk

Would You Like To Earn $1000 s With The Click Of A Button?

Tutorial Three: Categorising ideas using the SuperGrouper tool In Kidspiration there are two basic ways to organise ideas in Picture View: links and

Number Shapes. Professor Elvis P. Zap

SolidWorks Tutorial 1. Axis

Information Guide. This Guide provides basic information about the Dead Trigger a new FPS action game from MADFINGER Games.

No Evidence. What am I Testing? Expected Outcomes Testing Method Actual Outcome Action Required

Getting Started with Modern Campaigns: Danube Front 85

Introduction. Contents

Final Project: NOTE: The final project will be due on the last day of class, Friday, Dec 9 at midnight.

The game consists of 3 rounds where you will build a castle in 30 seconds then place catapults and steal wall pieces from your neighbors.

Getting Started with Coding Awbie. Updated

1

Multiple Quests using the ScriptEase II Story System

Manual For Minecraft Pe Diamond Survival Mode How To Get Iron

a. the costumes tab and costumes panel

October 17-18, Vision Weekend. We can make Jesus our king and follow him together. Nehemiah; Ephesians 6:10-18; Matthew 6:33

Newton Mining Co. A Teacher s Guide for the MinecraftEdu World Created by Joey Glatt All Rights Reserved Page 1

Meteor Game for Multimedia Fusion 1.5

Creating Journey With AgentCubes Online

Introduction to programming with Fable

This guide will cover the basics of base building, we will be using only the default recipes every character starts out with.

EG1003 Help and How To s: Revit Tutorial

Memory. Introduction. Scratch. In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

THOUSANDS TO MEASURE SUPPORT RESOURCES 1 INCH YARD METRE. Anna Quer Ceip Antoni Brusi

Transcription:

Introduction to Computer Science with MakeCode for Minecraft Lesson 2: Events 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 in Minecraft, and finally, we ll challenge you to create your own MakeCode projects that use events to activate different parts of your program. Events 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. Here are some examples: Event Action It starts raining Open umbrella The bell rings Students go to class The Power button is pressed Computer turns on Mouse button is clicked Open application Can you think of some other Events and possible subsequent actions? In programming, an event handler is a part of your program that runs when specific events happen (it handles the event). In MakeCode, these event handler blocks look like a square with a gap in the middle, and usually start with the word on : Unplugged Activity: Events and Handlers Teacher Note: An unplugged activity is an activity that takes place away from the computer, i.e., unplugged from a device. We usually try to introduce new concepts in a fun way that

gets kids up and moving, often reacting and interacting with other students face-to-face while playing a game or completing a challenge. Unplugged activities allow kids to practice concepts away from the computer so that when they move to activities on the computer, they have already walked through and thought about the concept on their own. Objective: To reinforce the event-driven programming model by acting out events and the resulting actions encapsulated by an event handler. Overview: Identify one-third of the class to be the Events, and the rest of the class will be the Event Handlers For the Event students, have them come up with an event to model. Students should invent their own events, but some examples could be: Door opens Lights turn off Clap hands twice Both hands raised Once they ve decided on their event, students should write down their event twice, on 2 different index cards. These cards should be shuffled and passed out to the Event Handler students. Once the Event Handler students have received their assigned events, they should come up with some sort of action to take based on this event. Students should invent their own actions, but some examples could be: Door opens Walk outside Lights turn off Go to sleep Clap hands twice Stomp feet 3 times Both hands raised Say Touchdown! Line up the Event students at the front of the classroom, and have each one perform their event. When the event is performed, the associated Event Handler students for that given event should also perform the subsequent action.

Once all the event and event handlers have been called, you can randomly call on different Event students to perform, and trigger different event handlers you can speed this up and see if the students react quickly to their assigned event. Materials: Index cards & pens/pencils Rules: Unless instructed otherwise, students do not speak or make noise during this activity unless it is part of their event or action. Students should be aware of the activities of the other people in the classroom, but cannot tell other students what to do. Reflections: Have a discussion about how that felt/worked: Were there any programming errors or bugs in the system? Did a student miss handling an event? What was it like to keep track of the different events going on? Sometimes there was more than 1 event handler for a given event how does that work? Could there be 1 event handler for multiple events? (yes) Could an event handler also trigger an event? (yes) If so, how would that work? (Lights turn off Go to sleep Teacher says Wake up! ) Tips: SAFETY FIRST! Students, especially younger ones, can get quite silly with this and while it is meant to be fun and even funny, safety first! Notes: Computer programming connection: Computer programs are a set of instructions telling the computer how to process input and deliver output. An important part of programming is telling the computer WHEN to perform a certain task. Events are a way to trigger certain instructions.

Activity: Yellow Brick Road Teacher Note: A birdhouse activity is named after the birdhouses many of us made as our first project in wood shop class. Everybody in class follows the same instructions to make the same thing. Once everybody comes out with a birdhouse that looks halfway decent, you know they have all had at least an introduction to the concepts through an unplugged activity, and practiced new skills by making the birdhouse. We like to move from unplugged activities to birdhouses in preparation for more creative, open-ended projects once we know they have demonstrated the skills at least once. Just don t stop after the birdhouse! Although it is easiest to assess skills with a birdhouse, be sure to give kids opportunities to apply those skills to meet more open-ended challenges. The On player walk block is an event handler that looks for a specific action by the player. Its pull-down menu lists all sorts of actions a player might perform at any given time, such as walking, jumping, attempting to swim in lava, and more. You can configure this event handler to cause something to happen when a player is walking. For example, you can leave flowers everywhere you walk! Steps: 1. From the Player Toolbox drawer, drag the On player walk block into the coding Workspace.

2. From the Blocks Toolbox drawer, drag the Place at block under the On player walk block until you hear and see it snap into place. 3. Using the drop-down menu in the Place at block, select a dandelion (yellow flower).

Now, wherever you walk in the game, you will leave a trail of dandelions! Try it out in the game by using the W key on the keyboard to have your Player walk forward in a Minecraft world. Then, look behind you you should see a trail of flowers! Teacher Note: We will be exploring the coordinate system in more detail in the next lesson. For now, it s enough to know that the 3 coordinates (X, Y, Z) represent different directions in the Minecraft game: X coordinate East / West Y coordinate Up / Down Z coordinate North / South

Notice that we used the coordinates (~0 ~0 ~0) in our Place block. ~0 in the middle coordinate represents the relative coordinate for ground level. Suppose we wanted to leave a golden path behind you, so that a yellow brick road were created wherever you walked? We can do that with the same Place at block, only this time we ll leave (of course) solid gold blocks. Watch what happens: The right idea, but not exactly what we are going for. We are actually leaving a gold wall behind us, which is rather inconvenient. How might we sink those blocks into the ground so that they form a yellow brick road? Let s modify the Y coordinate by subtracting one so that the bottoms of the bricks are one level down. Now, let s see what happens:

Much better! As an extension, try making it a proper yellow brick road, at least three bricks wide, so you and your friends can walk side by side. Hint: use a different block from the Blocks menu! Solution: Activity: Sing a Song of Sixpence Sing a song of sixpence,

A pocket full of rye. Four and twenty blackbirds, Baked in a pie. English Nursery Rhyme In this activity, students will take inspiration from this old English nursery rhyme to recreate this in Minecraft. But we shall use parrots instead of blackbirds, and cake instead of a pie! Steps: 1. From the Blocks Toolbox drawer, drag the On broken block onto the coding Workspace. This will be our event handler. 2. Using the drop-down menu, select the cake item 3. From the Mobs Toolbox drawer, drag a Spawn animal block under the On broken block until you hear it snap into place.

4. Using the drop-down menu in the Spawn animal block, select a Parrot 5. We want to spawn the parrots above our head, so in the Spawn animal block, change the Y coordinate to 1 This will just spawn 1 parrot above our head, so let s use a Repeat loop to spawn 24 parrots. 6. From the Loops Toolbox drawer, drag a Repeat loop under the On broken block, and around our Spawn animal block. 7. In the Repeat loop, type in the number 24 To run this in the game, add a cake to your Player inventory (press E to open your inventory), place a cake on the ground by selecting it in your toolbar and right-clicking somewhere on the

ground. Then hit it using the left mouse button to destroy it you should see a flock of parrots appear! Shared Program: https://makecode.com/_0ji3uvtdg4ds Activity: Last Stand at the Alamo In this activity, we will recreate the experience of being overrun by hordes of zombies. We will also see the effect of exponential growth: every time you kill a zombie, two more spring up in its place. What does that feel like? Let s find out! To start out with, make sure you are in a safe and/or easily defensible location. Jungle trees work well, as do castle turrets and even a fenced-in corral (where you are on the inside). Alternately, if you are in a flat world, you can just run free, shooting zombies as you go. It s a no-win situation anyway, so you might as well have some fun while you are in it. The event handler that we will be using is On monster killed to trigger new zombies spawning when one is killed. Steps: 1. From the Mobs Toolbox drawer, drag an On killed block into the coding Workspace

2. From the Mobs Toolbox drawer, drag a Monster block into the On killed block replacing the default animal block 3. Using the drop-down menu in the Monster block, select the zombie spawn egg Now, when a zombie is killed, we will spawn two new ones at a random location near the player. 4. From the Mobs Toolbox drawer, drag a Spawn animal block under the On killed event handler block 5. From the Mobs Toolbox drawer, drag a Monster block into the Spawn block 6. Using the drop-down menu in the Monster block, select the zombie spawn egg

7. We want to spawn 2 zombies for every one we kill, so from the Loops Toolbox drawer, drag a Repeat loop under the On kill block and around our Spawn block 8. In the Repeat loop, type in the number 2 Now we need to tell Minecraft where to spawn the Zombies. By default, notice that the relative coordinates are set to your Player s current location (~0 ~0 ~0). Spawning two zombies right on top of you isn t a great idea, so let s make them show up just a little farther away at random locations. 9. From the Positions Toolbox drawer, drag a Pick random position block and drop into the Spawn block replacing the default coordinates The two sets of coordinates in the Pick random position block describe opposite corners of a box within which zombies will spawn at random locations. Let s choose a box 10 blocks around your Player, which should create an area of about 400 square blocks centered on your location. 10. In the Pick random position block, type the from coordinates as (~10 ~0 ~10), and the to coordinates as (~-10 ~0 ~-10) JavaScript: mobs.onmobkilled(mobs.monster(monstermob.zombie), function () { for (let i = 0; i < 2; i++) {

mobs.spawn(mobs.monster(monstermob.zombie), positions.random( positions.create(10, 0, 10), positions.create(-10, 0, -10) )) } }) Shared Program: https://makecode.com/_vsexqc2vjbv9 To start the fun, open a Minecraft world in Creative mode. Then open your inventory and equip yourself with a weapon (ideally a ranged weapon like a bow), and then give yourself a Zombie spawn egg (you can use the search feature in your inventory). Next, change your game mode to Survival either through your Settings menu, or by typing this command into the chat window: /gamemode s. Tip make sure the Difficulty level of your game is not set to Peaceful the zombies won t attack. Finally, get behind a barricade, drop the Zombie spawn egg, and let the fun begin!

Independent Project Teacher Note: Open-ended, creative projects are opportunities to apply the concepts and skills students have developed to solve a problem or fill a need. In Minecraft, there are all sorts of problems to solve: How can you keep your cows from running away? How can you create a renewable water source? How can you get back to the surface after falling into a ravine? Projects allow kids to explore problems that are meaningful to them -- and to use MakeCode to design original, automated solutions to many of the problems they face in their everyday Minecraft lives. It is important to give kids opportunities to create original projects to demonstrate that they can apply their MakeCode skills in new ways, and to exercise their creativity. Remember that we learned in this section that events make things happen during the game. You will need to use event handler blocks to trigger different actions or results. In this project, your challenge is to come up with a simple MakeCode for Minecraft project that uses one or more of the following event handler blocks:

Event Handler Blocks On chat command On player died On player walk/run/jump/swim/ etc. On arrow shot On block broken On block placed On animal killed On monster killed For some of these blocks, you have many choices about the type of block, action, or animal affected. Sample Projects: 1. Kaleidoscope Build

In this project, every time you place a cobblestone block, three more are placed symmetrically relative to your location. X O O O X = block placed O = new blocks 2. Walk on Water When you are crossing a lake or a river, make blocks of ice or glass appear under your feet so that you are literally walking on water. 3. God of Weather

Create a chat command that makes it rain when it is clear, or turn clear when it is raining. 4. Spite Create a command that when active, spitefully kills everybody else when you die. Minecraft Diary 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 causeand-effect) Include at least one screenshot of your program working Share your project to the web and include the URL here

NOTE: If you decided to improve one of this lesson s activities, please talk about the new code you wrote in addition to what was already provided in the lesson. Assessment 1 2 3 4 Diary Minecraft Minecraft Minecraft Minecraft Diary Diary entry is Diary entry is Diary entry is addresses all missing 4 or missing 2 or 3 missing 1 of prompts. more of the of the the required required required prompts. prompts. prompts. Project Project lacks Project: Uses Project: Uses at Project: Uses at all of the at least one least one event least one event required event handler handler block; handler block; elements. block; OR OR causes an AND causes an causes an intentional intentional intentional effect or solves effect or solves effect or a problem. a problem. solves a problem BUT code is ineffective or flawed. CSTA Standards CPP.L1:6-05 - Construct a program as a set of step-by-step instructions to be acted out CPP.L1:6-06 - Implement problem solutions using a block-based visual programming language