← Back to Phase 1 Phase 2: MakeCode Next: Phase 3 →

🔷 Phase 2: MakeCode

Visual Programming - Code with Blocks!

Skeleton Coding with MakeCode

Welcome to MakeCode!

MakeCode is a visual programming language that uses blocks (like digital LEGO) to create code. It's perfect for learning because:

💡 What You'll Learn: Variables, loops, functions, events, and conditions - the building blocks of ALL programming languages!

Setting Up MakeCode

💡 2025 Update: The easiest way to use MakeCode is with Minecraft Education Edition (it's free!). It has Code Builder built right into the game!

🎓 Recommended: Minecraft Education Edition

  1. Download Minecraft Education Edition (free!)
  2. Install and open it
  3. Create a new world with cheats enabled
  4. Press the C key or type /code in chat
  5. Select "MakeCode" from the Code Builder menu
  6. The MakeCode editor opens right next to your game!
✅ That's it! You can now code while playing - no external apps needed!

🔧 Alternative: MakeCode Web Editor

If you prefer to use regular Bedrock Edition:

  1. Go to minecraft.makecode.com
  2. Click "New Project"
  3. Build your code in the web editor
  4. Download as a behavior pack
  5. Import into Minecraft
Need more help? Check the detailed setup guide with troubleshooting!

The MakeCode Interface

When you open MakeCode, you'll see three main areas:

MakeCode Interface
💡 Block Categories:
  • Player: Things related to your character
  • Blocks: Place and destroy blocks
  • Mobs: Spawn creatures
  • Gameplay: Time, weather, effects
  • Positions: Locations in the world
  • Logic: If/then decisions
  • Loops: Repeat actions
  • Variables: Store information

Your First MakeCode Program

Project: Rainbow Trail

Let's make a program that creates a rainbow trail wherever you walk!

Step-by-Step:

1. Add an Event Block

  1. Look in the Player category (left panel)
  2. Drag the "on player walk" block to the workspace
🤔 What's an Event? An event is something that happens that triggers your code. "on player walk" means "when the player moves, do this..."

2. Add a Block Placement

  1. Go to the Blocks category
  2. Find the "place [block] at [position]" block
  3. Drag it and snap it INSIDE the "on player walk" block

3. Choose Your Block Type

  1. Click where it says the block type (probably "grass")
  2. Choose a colorful block like "red wool" or "diamond block"

4. Set the Position

  1. Click on the position part
  2. Choose "world position at ~0 ~-1 ~0"
🤔 What does ~0 ~-1 ~0 mean?
  • ~0 - Same X position as player
  • ~-1 - 1 block below player (under their feet)
  • ~0 - Same Z position as player

5. Test It!

  1. Make sure Minecraft is open and Code Connection is connected
  2. Walk around in Minecraft
  3. You should see colored blocks appearing where you walk!
Rainbow trail of colored blocks in Minecraft
🎉 Amazing! You just created your first MakeCode program! You learned about:
  • Events: Triggering code when something happens
  • Actions: Doing something (placing a block)
  • Positions: Specifying where in the world

Make It Better: Random Colors!

Let's make the trail change colors randomly:

  1. Go to Variables category
  2. Click "Make a Variable" and name it "color"
  3. Drag "set color to" block above your place block
  4. Go to Math category
  5. Drag "pick random 0 to 10" and attach it to the "set color to" block
  6. Change 10 to 15
  7. Now change your "place block" to use different colors based on the number!

Understanding Loops

Loops let you repeat actions - super powerful for building!

Project: Instant Tower

Let's build a tower with one command!

Step-by-Step:

  1. Start with "on chat command" from the Player category
  2. Change "run" to "tower"
  3. Add a "repeat 10 times" loop from the Loops category
  4. Inside the loop, add "place stone at ~0 ~0 ~0"
  5. Go to Variables, create a variable called "height"
  6. Before the loop: "set height to 0"
  7. Inside the loop, after placing the block: "change height by 1"
  8. Change the Y position in your place block to use the "height" variable

Now when you type "tower" in chat, a 10-block tall tower appears!

🎓 What You Learned:
  • Loops: Repeating actions (repeat 10 times)
  • Variables: Storing numbers (height)
  • Incrementing: Changing values (height goes up each time)
  • Chat Commands: Triggering code by typing in chat

Understanding Conditionals (If/Then)

Conditionals let your program make decisions!

Project: Smart Builder

Let's make a program that places different blocks depending on where you are!

  1. Start with "on player walk"
  2. Add an "if then else" block from Logic
  3. For the condition, use "block at position is [type]"
  4. Set it to check if the block below is "grass"
  5. If grass: place a "flower"
  6. Else: place a "torch"

Now flowers appear on grass and torches appear on other blocks!

🎓 Conditionals are powerful! You just taught your program to make decisions. This is called "logic" and it's what makes programs smart!

Cool Projects to Try

Easy Projects:

1. Instant House

Use nested loops (a loop inside a loop) to build a house:

2. Mob Spawner

Create a chat command that spawns different animals in a circle around you:

3. Block Breaker

Create a tool that breaks blocks in a 3×3 area:

Medium Projects:

4. Treasure Hunt

Hide treasure and give players hints:

5. Super Jump

Create a chat command that makes you jump really high:

6. Auto Bridge

Automatically build a bridge as you walk over water:

Advanced Projects:

7. Simple Minigame

Create a "collect the diamond" game:

8. Parkour Course Generator

Auto-generate a parkour course:

9. Building Assistant

Create tools to help with building:

Functions: Organizing Your Code

As your programs get bigger, you'll want to organize them into functions!

What's a Function?

A function is a named group of blocks that does ONE specific thing. You can use it over and over!

Example: Circle Builder

  1. Go to Functions category
  2. Click "Make a Function" and name it "buildCircle"
  3. Inside the function, add code to build a circle
  4. Now you can use "call buildCircle" anywhere in your code!
💡 Why use functions?
  • Makes code easier to read
  • Lets you reuse code
  • Makes debugging easier (fix in one place)
  • Professional programmers use functions all the time!

Seeing the JavaScript Code

Here's something cool: MakeCode is actually creating JavaScript code behind the scenes!

Switch to JavaScript View:

  1. Look for the "Blocks" / "JavaScript" toggle at the top of the editor
  2. Click "JavaScript"
  3. You'll see the actual code your blocks create!
🤔 Why is this cool? You can learn JavaScript gradually! Start with blocks, then peek at the JavaScript to see what it looks like. When you're ready, you can edit the JavaScript directly! That's what Phase 3 is all about.

Example - your rainbow trail in JavaScript:

player.onTravelled(TravelMethod.Walk, function () { blocks.place(DIAMOND_BLOCK, positions.create(0, -1, 0)) })

See? It's not that scary! And you already understand what it does because you built it with blocks!

Tips & Best Practices

Organizing Your Code:

Debugging Tips:

Performance Tips:

Sharing Your Creations

Save Your Projects:

MakeCode saves your projects automatically in your browser. Give them good names!

Export to Share:

  1. Click the settings gear icon
  2. Choose "Download"
  3. This saves a .mkcd file you can share with friends
  4. They can import it in their MakeCode!

Deploy to Your Server:

Ask your uncle to help you turn your MakeCode projects into behavior packs that can run on the family Minecraft server! That way everyone can enjoy what you create!

What's Next?

🎉 You've Completed Phase 2!

You've learned:

  • ✅ Visual programming with blocks
  • ✅ Variables and data storage
  • ✅ Loops and repetition
  • ✅ Conditionals and logic
  • ✅ Functions and code organization
  • ✅ Events and triggers

These are the SAME concepts used in Python, Java, C++, and every other programming language!

When you're comfortable with MakeCode and want to write code like a professional developer, move on to Phase 3: JavaScript Programming!

💡 Before Moving On: Try building 3-5 projects from the list above. The more you practice with MakeCode, the easier JavaScript will be!
Continue to Phase 3: JavaScript → ← Back to Phase 1 Home