Welcome to the LearnToMod Hour of Code | MAZE EDITION!
LearnToMod is a software that teaches you how to write Mods (which is actually writing code!)
You get a sneak peak of Vox-L (LearnToMod's 3D in-browser game engine), learn how to write a Mod that makes your own unique maze, and test your Mod in Vox-L!
The best part is that LearnToMod lets you mod Vox-L, but you can also mod Minecraft with the same code!
Before you start, make sure you have: A Computer with a Mouse and Keyboard connected to the internet A Piece of Graph Paper and a Pencil
Click on the button below to get started now!Step 1: Click on the "Functions" category on the left of your screen, then click and drag a function block into the center of your screen and rename the function "main":
Step 2: Click on the "Variables" category on the left of your screen, then click and drag a new variable block into your main function and rename the variable "d":
Step 3: Click on the "Vox-L", then "Drone" categories on the left of your screen, then click and drag a new drone block into your "d" variable:
Step 4: Now that you have a handle on where to get coding blocks, we will give you fewer instructions!
Back in the "Drones" category drag a "Move in direction" and "Drone places block of type" into your "main" function.
Change the move block to go forward a distance of 1.
Then from the "Materials [D-G]" category, drag a "DIAMOND_BLOCK" into the "Drone places block of type" block:
Step 5: Here comes the fun part! You get to test it in the simulator!
Vox-L has the same controls as Minecraft! WASD moves you forward, left, right, and backwards. And you can type the ESC key on your keyboard to get out of Vox-L world.
On the bottom of the left hand side, click on the purple play button (triangle):
Your browser will ask if it's ok for Vox-L to use your mouse curser, click "Allow":
In Chrome:
In Firefox:
Then double-click back into your game!
Now you can explore your Vox-L world! Even better - when you type 'm' while you are walking around in Vox-L a block will appear!:
Step 6: In the "Loops" category, drag a "repeat" block to go around your "Move Drone" and "Drone Place" blocks:"
Then click on the play button again, and type 'm' to see what it makes:
Step 7: Add 3 more loops to your function:
Before you test your mod, predict what you think will be drawn:
Check Your Prediction: Click on the Play button to test your mod! You should see something like this:
If your prediction was different, try to understand why.
PLAY TIME! Woah! You just did a ton of coding! You have written 15 lines of code already!
CONGRATULATIONS!
Now it's time to play around in Vox-L a little bit! Take 5 minutes and explore the world. You can either click the Play button, or you can double-click anywhere in the world to enter it!
Refactor Your Mod: Expert Modders never write all of their code perfectly. They make mistakes as their mods get longer and more complex.
As a modder, you won't know everything that needs to be included in the mod at the very beginning. Maybe you want to include a custom statue, but you didn't think that you would make TWO custom statues until you saw how easy it was to make one!
When you change the way your code looks, without changing the actual effects of the code, it's called "refactoring".
Step 8: From the "Functions" category, drag a new function into your coding area, and call it "square".
Put all of the code that is in your main function into the new function, except for the block that creates a new drone.
Go to the "Functions" category and drag "square" block (block that has the name square on it) into the main function:
Step 9: Now that creating a square is easy, you can create a bunch of squares on top of each other to create a tower!
Just add in a Move Drone Up Block into your main function, and then add a loop around the call to "square" and the "Move Drone Up" blocks that should repeat 10 times.
When you test your mod, you should see this in your world:
Check Step 9: In Step 9, you should have tested your mod to make a tower that is 10 blocks high.
But you can also compare your mod with my mod:
What did you do differently?
Step 10: Here comes the creative (but tricky!) part!
Before you start coding your maze, you should design it on graph paper, checkout my simple maze:
Draw your maze on your graph paper too!
Step 11: On the side of your drawing, write out what you think you should do to help the drone build your maze.
Expert modders do this too! It's a part of the designing and planning phase and it's called "Psuedo-Code"!
I did it for my simple maze too:
Step 12: Now convert your Psuedo-Code into real code for your maze mod!
I built my mod in pieces, first I made all of the functions and the main function:
Then I wrote the Column1 Function:
Then I wrote and tested the Column2 and Column3 functions:
Then I wrote and tested Column4 and Column5 functions :
Then I wrote and tested Column6 and Column7 functions:
Step 13: Test your Mod and make sure you like your first design:
Here is my mod:
Step 14: Then just like we did for our tower, add a Drone Move Up block and put a loop around it:
Step 15: And now you can test it and you can see if you can beat the maze!
AMAZING JOB!
Share Your Maze: Now it's time to share your maze! Take a video of you explaining your mod's code and exploring your mod!
Then - ask your parents permission to share it on YouTube with the title "LearnToMod Maker Maze"!
CONGRATULATIONS
Make sure you check out what else you can do on LearnToMod by visiting LearnToMod.com