The reason there are 21 blocks is because in Minecraft, 0
is also a place where you can put a block. So, 0
is included in the 21 places to put blocks.
Activity: Create a Compass Rose
Students will practice using coordinates in Minecraft to create a simple compass rose that points to the four cardinal directions within a Minecraft world. Students can then use this as the basis for creating more individualized and detailed compass roses.
Do the activity
Make a chat command
Create a new MakeCode project called “Compass Rose.”
From
||player:PLAYER||
, drag a||player:on chat command||
block out and change the command to"compassrose"
.
player.onChat("compassrose", function () { })
Fill an axis
Next, from
||blocks:BLOCKS||
, place a||blocks:fill with||
block inside the||player:on chat command||
block.Adjust the
||blocks:fill with||
block from grass to whatever you want the axis to be. The example here uses gray wool for the axis.Put the values
(~-10 ~-1 ~0)
infrom
and(~10 ~-1 ~0)
into
. This will print out a line of 21 blocks along the X-axis. The line will be under your feet, and you will be in the very center.
player.onChat("compassrose", function () {
blocks.fill(
GRASS,
pos(-10, -1, 0),
pos(10, -1, 0),
FillOperation.Replace
)
})
Print east and west directions
In ||blocks:BLOCKS||
, you will find ||blocks:print||
. This prints words with any block you choose along a specified axis.
Drag out two
||blocks:print||
blocks and place them after||blocks:fill with||
.Enter “W” in the first
||blocks:print||
and “E” in the second||blocks:print||
to indicate west and east.Select a block to
||blocks:print||
the letters in. In this example, lime wool is used for west and yellow wool for east.In
||blocks:print||
"W"
, enter(~-11 ~0 ~0)
..In
||blocks::print||
"E"
, enter(~11 ~0 ~0)
.
player.onChat("compassrose", function () {
blocks.fill(
GRAY_WOOL,
pos(-10, 0, 0),
pos(10, 0, 0),
FillOperation.Replace
)
blocks.print(
"W",
LIME_WOOL,
pos(-11, 0, 0),
WEST
)
blocks.print(
"E",
YELLOW_WOOL,
pos(11, 0, 0),
WEST
)
})
Repeat for north and south
Repeat steps 3 through 10, this time for the north-south axis of the compass rose:
From
||blocks:BLOCKS||
, place a||blocks:fill with||
into the||player:on chat command||
.Adjust the
||blocks:fill with||
block from grass to whatever you want the axis to be. This example uses black wool for the axis.Put the values
(~0 ~-1 ~-10)
infrom
and(~0 ~-1 ~10)
into
. This will print out a line of 21 blocks along the Z-axis.Drag out two
||blocks:print||
blocks and place them after the newest||blocks:fill with||
.Enter “N” in the first
||blocks:print||
block and “S” in the second||blocks:print||
block to indicate north and south.Select a block to
||blocks:print||
the letters in. This example uses blue wool for north and red wool for south.In
||blocks:print||
"N"
, enter(~0 ~0 ~-11)
.In
||blocks:print||
"S"
, enter(~0 ~0 ~11)
.
Complete program
player.onChat("compassrose", function () {
blocks.fill(
GRAY_WOOL,
pos(-10, -1, 0),
pos(10, -1, 0),
FillOperation.Replace
)
blocks.print(
"W",
LIME_WOOL,
pos(-11, 0, 0),
WEST
)
blocks.print(
"E",
YELLOW_WOOL,
pos(11, 0, 0),
WEST
)
blocks.fill(
GRAY_WOOL,
pos(0, -1, -10),
pos(0, -1, 10),
FillOperation.Replace
)
blocks.print(
"N",
BLUE_WOOL,
pos(0, 0, -11),
WEST
)
blocks.print(
"S",
RED_WOOL,
pos(0, 0, 11),
WEST
)
})
Shared Program:
Go into a Flat World in Minecraft and enter compassrose in the chat command line. For best results, have your player stand still while the letters are being drawn – remember, the positions are being calculated relative to you as the player, so if you move around, the letters will show up in different places!
Challenges
Now you can change some things to make your own different and unique situations!
Challenge 1 - Create a Bigger Compass
Extend the axis of your compass rose to 41 blocks long. Can you get the letters to print nicely on the end of this new, bigger compass rose?
Challenge 2 - Build an Air Compass
Add an up-and-down Y-axis and labels. Make your compass up in the sky, so you can look up and see it as you walk along.
What you will need to do:
- First, you need to move the regular compass into the sky. What coordinate (X, Y, or Z) would you change?
- Next, you need to build an axis for Y. How could you copy existing code, change it a little, and accomplish that?
- Finally, print out the words “up” and “down.”
Experiments
Here there are no rules… Copy the code for the experiments and change things around to see what kind of results you can create. Suggestions are given, but do as you like!
Experiment 1 - Use Color for Directions
Instead of using Gray Wool to print out a line of blocks along the X, Y, and Z axes, you can select different colors to represent the three different directions.
Use this code to start with.
What else might you add to make this more entertaining? What if chickens appeared after blocks? Chickens running along the east/west axis might be interesting. Could you somehow make arrows instead of just straight lines?
Experiment 2 - Use Colors to Represent Other Compass Features
How about changing the colors of the printed text to the colors of the X, Y, and Z axes? You could change all the colors to something else. You could theme this out a little - make the compass in wood and then use stone and other items to give this compass a medieval theme. How would you theme it?
Use this code to start with.
What if instead of creating a theme you change the code so the Y-axis goes up all the way from the ground like a tower?