8-10 yrs old
May 2, 2017
In computer science, a “function” is a way to group commands together. For example, the function of Waving might group the following commands together:
From the Player Toolbox drawer, drag and drop the On Chat Command block onto the
Rename this command to “rain”
From the GamePlay Toolbox drawer, drag and drop the Weather block onto the coding Workspace.
Drag the Weather block under the On Chat Command event
Using the drop-down menu, change the weather to rain
In your Minecraft game, press ‘t’ to open the chat screen. Type “rain” and press Enter. You should see it start raining in Minecraft!
From the Mobs Toolbox drawer, drag and drop the Spawn Animal at Position block onto the coding Workspace.
Drag the Spawn Animal at Position block under the On Chat Command event
Use the Animal block drop-down menu to select an ocelot
Right-click on the Spawn Animal at Position block to open the context menu, and select Duplicate to copy the block
Drag the second Spawn Animal at Position block underneath the first
Use the Animal block drop-down menu on the second Spawn Animal at Position block to select a wolf
Our Rain function will now spawn 1 ocelot and 1 wolf at the Player’s position before making it rain. Let’s use a parameter and a loop to spawn multiple animals. From the Loops Toolbox drawer, drag and drop the Repeat block onto the coding Workspace.
Position the Repeat loop under the On Chat Command block, and drag the 2 Spawn Animal at Position blocks inside the Repeat loop
Click on the blue cog/gearwheel icon in the On Chat Command block, drag and drop a number parameter block under the Command Arguments block. This will create a number parameter for our Rain function. Click on the blue cog/gearwheel icon again to close the Parameters menu.
From the Variables Toolbox drawer, drag and drop the number block onto the coding Workspace.
Drag the number block into the Repeat loop block
Let’s change the position where our Ocelots and Wolves are spawning. Right now, they are spawning at the Player’s position at ~0 ~0 ~0. From the Positions Toolbox drawer, drag and drop a Pick Random Position block onto the coding Workspace.
We want our animals to spawn 5 blocks above our Player, and at random locations 10 blocks all around our Player. Set the values of your Pick Random Position block according to the following:
Right-click on the Pick Random Position block to open the context menu, and select Duplicate to copy the block
Drag and drop the 2 Pick Random Position blocks into the Spawn Animal at Position blocks. Your completed program should look like this:
In your Minecraft game, press ‘t’ to open the chat screen. Type: “rain 4”. You should see it start raining 4 ocelots and wolves all around you in Minecraft! Now try typing different numbers into your Rain function: “rain 40”, or “rain 400”.
Introduction to Logic Gates
What's the logical password?
Make a Flower Trail Wherever You Go
In this lesson, we will create a trail of flowers for our player ...
Build a coral reef time lapse in a Minecraft world
Events in Programming
Learn about events and event handlers.
Build with the agent
10 building exercizes with automatic testing
Creating a magical castle using code
4th Grade NGSS Science
This project shows how you can create a rainbow in Minecraft usin...
4th Grade Engineering Challenge
NGSS 3rd Grade Science - Forces
Build a Dam
3rd Grade Engineering Challenge
Creeper Tower Test
5th Grade Engineering Challenge
Surface Area and Perimeter
6th Grade CCSS Math
How to build a Square
Use the companion app MakeCode to a square using blocks of your c...
Design various coral reefs with Minecraft and code
Easy gameplay for beginners in coding
NGSS 5th Grade Science - Earth's Systems
Fractions Pixel Art
Break down pixel art into fractions.
Sensors in Monitoring and Control Systems
Ice Fishing Derby
5th Grade CCSS Math
Wall Follower Algorithm
Guide the agent through a simple maze
The Wild Robot Escapes
An intro lesson for the book Wild Robot Es
Number Line Railroad
CCSS 4th Grade Math
Find the Button
Great introduction to coding using command blocks
Agent Guided Book Tour CS, ELA
Students bring together ELA,CS,and design concepts
BINARY DIAMOND RUSH
How information is encoded into binary code in PC
Magical Castle2: Zombie Attack
Create a Zombie Attack game in the Magical Castle
Quadrilateral Capture the Flag
Compare, contrast & define different quadrilaterls
Make a Clock
Students will code a clock in Minecraft.
Minecraft version of classic Bomberman game
Mining with the Agent: Part I
Using the Agent for vertical shaft mining
Introduction à la programmation en 2nde
Mining with the Agent: Part II
Further develops concepts of mining with the Agent
Shapes From Shapes
Make a shape made out of smaller, equal sized piec
Codegame in Icelandic