Welcome to MakeCode!
MakeCode is a visual programming language that uses blocks (like digital LEGO) to create code. It's perfect for learning because:
- ✅ You can see your code as colorful blocks
- ✅ You can't make syntax errors (the blocks fit together correctly)
- ✅ You can build structures instantly, create mini-games, and more
- ✅ It teaches real programming concepts
- ✅ When you're ready, you can see the JavaScript code it creates!
💡 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
- Download Minecraft Education Edition (free!)
- Install and open it
- Create a new world with cheats enabled
- Press the C key or type /code in chat
- Select "MakeCode" from the Code Builder menu
- 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:
- Go to minecraft.makecode.com
- Click "New Project"
- Build your code in the web editor
- Download as a behavior pack
- Import into Minecraft
The MakeCode Interface
When you open MakeCode, you'll see three main areas:
- Left Panel (Toolbox): All the code blocks you can use, organized by category
- Middle Panel (Workspace): Where you drag and snap blocks together to build your program
- Right Panel (Minecraft): Shows your Minecraft player (when connected)
💡 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
- Look in the Player category (left panel)
- 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
- Go to the Blocks category
- Find the "place [block] at [position]" block
- Drag it and snap it INSIDE the "on player walk" block
3. Choose Your Block Type
- Click where it says the block type (probably "grass")
- Choose a colorful block like "red wool" or "diamond block"
4. Set the Position
- Click on the position part
- 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!
- Make sure Minecraft is open and Code Connection is connected
- Walk around in Minecraft
- You should see colored blocks appearing where you walk!
🎉 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:
- Go to Variables category
- Click "Make a Variable" and name it "color"
- Drag "set color to" block above your place block
- Go to Math category
- Drag "pick random 0 to 10" and attach it to the "set color to" block
- Change 10 to 15
- 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:
- Start with "on chat command" from the Player category
- Change "run" to "tower"
- Add a "repeat 10 times" loop from the Loops category
- Inside the loop, add "place stone at ~0 ~0 ~0"
- Go to Variables, create a variable called "height"
- Before the loop: "set height to 0"
- Inside the loop, after placing the block: "change height by 1"
- 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!
- Start with "on player walk"
- Add an "if then else" block from Logic
- For the condition, use "block at position is [type]"
- Set it to check if the block below is "grass"
- If grass: place a "flower"
- 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:
- Outer loop: builds walls (4 walls)
- Inner loop: builds each wall (height of wall)
- Add a roof using another loop!
2. Mob Spawner
Create a chat command that spawns different animals in a circle around you:
- Use a loop to repeat 8 times
- Each time, spawn a mob at a different position
- Use math to calculate positions in a circle!
3. Block Breaker
Create a tool that breaks blocks in a 3×3 area:
- Use "on block broken" event
- Use nested loops to destroy surrounding blocks
- Great for mining!
Medium Projects:
4. Treasure Hunt
Hide treasure and give players hints:
- Place a diamond block somewhere
- When players walk, tell them "warmer" or "colder"
- Use player position and math to calculate distance
5. Super Jump
Create a chat command that makes you jump really high:
- Detect when player is on ground
- When they jump, teleport them up!
- Add a cool particle effect!
6. Auto Bridge
Automatically build a bridge as you walk over water:
- Detect when you're over water
- Place a block below you
- Make it glass so you can see the water!
Advanced Projects:
7. Simple Minigame
Create a "collect the diamond" game:
- Spawn diamond blocks at random locations
- Keep score when players break them
- Use variables to track score
- Announce the winner after 1 minute!
8. Parkour Course Generator
Auto-generate a parkour course:
- Use loops to place platforms
- Use random numbers for platform positions
- Make some platforms move!
9. Building Assistant
Create tools to help with building:
- Copy/paste structures
- Fill areas with patterns
- Replace all blocks of one type with another
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
- Go to Functions category
- Click "Make a Function" and name it "buildCircle"
- Inside the function, add code to build a circle
- 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:
- Look for the "Blocks" / "JavaScript" toggle at the top of the editor
- Click "JavaScript"
- 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:
- Use clear variable names: "playerScore" not "x"
- Group related blocks together
- Use comments to explain what your code does (right-click blocks)
- Break big projects into smaller functions
Debugging Tips:
- Use "say" blocks to print messages - helps you see what's happening!
- Test small pieces at a time
- If something doesn't work, disconnect and reconnect Code Connection
- Check that blocks are snapped together properly
Performance Tips:
- Don't use "on player walk" to do too much - it runs VERY often!
- Use chat commands for heavy operations instead
- Be careful with big loops (don't loop 10,000 times!)
Sharing Your Creations
Save Your Projects:
MakeCode saves your projects automatically in your browser. Give them good names!
Export to Share:
- Click the settings gear icon
- Choose "Download"
- This saves a .mkcd file you can share with friends
- 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