Learn to build Minecraft games such as Capture the Flag, Slimeball Soccer, Tower Defense, and more.
* Online courses require a modern desktop computer, laptop computer, Chromebook, or Netbook with Internet access and a Chrome (29+), Firefox (30+), Safari (7+), or Edge (20+) browser. No downloads required.
Lesson: CTF: Part 1
Time: 45+ mins
IntroductionThis is the first lesson of the course, where campers are introduced to Tynker, block-based coding, and will learn how to link their Tynker and Minecraft accounts. Before campers begin the coding activities, make sure that they can get onto the Tynker server and join their own private server. Optional: Complete the first few activities together as a class. Make sure to think out loud through your logic as you code. Also inform campers that each lesson has DIY (do-it-yourself) modules where they'll need to apply everything they’ve learned at camp to create fun, Minecraft projects! Below are some teacher tips to help you get started:
- Review the teacher guide before assigning the lesson. This will give you a sense of what campers will be working on and what issues you should anticipate. This is also a good opportunity to familiarize yourself with the concepts they will be learning.
- Familiarize yourself with the material by completing each lesson before assigning it to campers. This will make it much easier for you to help campers. You can also experiment further with the concepts in Tynker’s Mod Designer.
- Review the answer key for each lesson before class so you have it available if campers run into any issues.
- Tynker’s lessons intentionally do not check whether a camper’s DIY project is “done” because this would require checking against a single completed sample to see whether the project matches exactly. Note: This means that the system will mark a DIY project as complete as soon as the camper clicks the “I’m Done” button on the last slide of the tutorial, even if they haven’t completed the entire tutorial. It is up to you to check that campers are actually completing the DIY projects. A good way to do this is to ask them to show off their completed projects. This will encourage them to complete the project as well as to make it their own!
In this lesson, campers will apply what they've learned to create 3 new Minecraft projects! As campers complete the first project, Rise and Shine, they'll review how to program entities to ride other entities. They'll also learn how to set the world time on their server using the "set world time" code block. In the second project, campers will create a function that creates a spawning point and returns the spawn location. In the final project, campers will create a basic setup for a "Capture the Flag" game. Campers will also review the following: Setting up a Minecraft and Tynker account, using the drone tool, using functions with the drone tool, variables, and parameters.
- Computer or laptop (1 per camper) with internet access
- A Minecraft client and login for each camper
- Tynker student accounts (1 per camper)
New Code Blocks
: Run code attached to this block when you deploy a mod or first join your private Tynker server. : Send a message to everyone playing in your private Tynker server. : Send a message to the specified player in your private Tynker server. : Make Minecraft particles (e.g., smoke, snow, explosions) appear. : Run code attached to this block when the player moves from one block to another. : Run code attached to this block when the player moves to the specified location. : Run the code attached to this block when the user types "/ty" in the Minecraft command line. : Run code attached to this block when the player breaks any Minecraft block. : Make one entity start riding the specified entity. : Move the drone to the specified location. : Move the drone in the specified direction by the specified amount : Place the specified Minecraft block at the drone's current location. : Set the specified variable to the specified value. : Remove all specified entities. : Spawn the specified entity at the specified location. : Run the code inside this block if the given condition is True. : Set the color of the sheep's wool to a specific color.
- Coding: Using a computer language to tell the computer what to do.
- Tynker blocks: Blocks that represent programming concepts and can be attached to create programs.
- Event block: Blocks that will run any blocks attached to them when the specified event occurs. Examples include the “on start” block (runs all attached blocks when the program starts) and the “when [player] moves to [location]” block (runs all attached blocks when any player moves to a new location). You can recognize them because they are shaped differently from other blocks (notch in the bottom but not the top).
- Sequence: The order in which steps or events happen.
- Mod: A term that's short for "modification," and refers to any changes of items, blocks, or mobs that are different from the "official" Minecraft version.
- Tynker Mod Designer: This is where you will create all their Minecraft mods and games. On the left, you’ll see all the code blocks and in the middle, you can drag the code blocks to create your program.
- Skins: The texture and appearance of Minecraft characters or items, which you can customize and design.
- Mobs: The animals and monsters in the Minecraft world, such as sheep, pigs, and creepers.
- Parameter: An extra piece of information that is passed into a function. Example: The block “when [player] moves to another block [location]” has two parameters: player and location.
- Drone tool: A tool in Minecraft that allows the user to build 3D structures using code. It has two properties: location and direction.
- Function: A sequence of commands that can be run together as if it were a single command. Functions are usually used when the same instructions must be repeated.
- Function definition: A function code block that describes what the function will do (what blocks will run when the function is used). Note that this code block is rounded.
- Function call: A function code block that can be used multiple times to call a function in your code. Note that this is a rectangular code block.
- Variable: Variables store a single piece of information, such as a word, an entity, or a number. You can set the value in a variable to anything and, if it’s a number, there are certain predefined things you can do to this variable, like increase it by a certain number using the "change" block.
- Local Variable: Local variables can only be accessed from within the same script where they were created. This variable is created using the "script variables" block.
- Global Variable: Global variables can be accessed or changed anywhere. This variable is created by clicking on the "Blocks" tab and going to the "Variables" section, where you can create a new variable.
- Set up a Tynker account
- Link their Minecraft account to their Tynker account
- Customize the character’s skin
- Deploy mods to their private Minecraft server
- Use code blocks and apply coding concepts to design a mod
- Use event code blocks to detect events that happen in the game
- Apply coding concepts to create projects
- Use functions and variables
- Set up a capture the flag game in Minecraft
Getting Started (5 minutes)Lead a discussion with your class. Ask campers...
- What is "mod" short for? (Answer: modification)
- Can anyone give an example of a Minecraft mod? (Answers will vary)
- What are you looking forward to learning in the Minecraft Modding course? (Answer will vary)
Activities (40+ minutes)The lessons are intended for self-directed learning. Your role will be to facilitate as campers complete the CTF: Part 1 modules on their own:
1. Getting Started (Video)
- Campers will watch a short video that explains how to set up their Tynker Minecraft account.
- Optional: As campers go through the course, ask them to make a list of what mods or games they would like to make.
- Make sure all campers are able to log in to their Tynker accounts.
- Make sure campers are able to successfully join Tynker’s Minecraft server and link their Tynker account and Minecraft account. If campers are waiting for help, they can explore the Tynker lobby world, where they can preview different kinds of games and mods they will be able to create using Tynker.
- Help campers navigate to the “Minecraft” section, then the “My Server” tab.
- Make sure all campers enter their Minecraft profile name. Inform campers that capitalization matters and there should be no spaces or extra characters.
- Allow campers to name their world.
- Ask campers to open Minecraft and log in. From the title screen, they should select the “Multiplayer” option and add a new server. The server address must be mc.tynker.com.
- Have campers join Tynker’s Minecraft server for the first time and allow them to explore.
- To test if your camper's Minecraft and Tynker accounts are successfully linked, have them type “/join” from the Tynker lobby world or walk through the central purple portal. The first time they join their own world, it may take several minutes and it may even cause them to exit the server. This is not a problem. Just ask campers to re-enter the Tynker server.
- Campers will watch a short animation of Cap and Janet reviewing concepts such as events, the "set world time" code block, and how to make entities ride other entities.
- Remind campers that multiple entities can also be stacked on each other.
- In this DIY (do-it-yourself) project, campers will follow step-by-step directions to learn how to create a mod where the player can pick up entities by touching them!
- Coding activities include setting the Minecraft world's time to daytime, programming entities to ride the player when the player touches the entity, and customizing the project.
- Campers are introduced to the "set world time" code block, which sets the time of day in Minecraft. Point out that "H" represents hours, "M" represents minutes, and "S" represents seconds. So a setting of H:12 M:0 S:0 represents the time 12:00 PM.
- One of the main things that campers often want to do in Minecraft is build. Campers will watch a short video that introduces the drone tool, which allows them to build 3D structures using code.
- Point out to campers that the drone tool can also be used to create geometric shapes, construct pyramids, write text, build roads/houses, and more! One of the advantages of using the drone tool is that it makes building complex structures faster and easier.
- The drone always has two properties: its location and direction. When spawned, the drone will appear at the targeted block up to 10 spaces away from the player in the direction they are facing.
- Point out to campers that before they use the drone tool, they might want to clear out the area where they want to build. (You’ll get a trick for doing this with the drone in lesson 3!)
- Building with the drone requires visualizing the structure and keeping track of the drone’s location and direction. If campers are struggling, ask them to draw out what they’re building on paper before they use the drone tool.
- Cap and Janet reviewing the drone tool and functions.
- When campers use the drone tool, they can point it in a direction, move it to a specific location, and place a block type at its current location.
- Remind campers that functions are a group of code commands that can be run together as if it were a single command. Functions are useful when you want to perform the same actions many times but you do not want to have a lot of repeated code blocks.
- Campers are provided three different functions, where each function returns something different.
- In this project, campers will define a function that creates a spawn point and returns the spawn location.
- Remind campers that the code that a function runs will be described in a “function definition” block. To use the function, students will need to use the “function call” code block.
- The "create spawn point" function needs to build a spawn point structure and return the "location" above the structure.
- Once campers finish coding their function, they'll need to add code blocks that will call the "create spawn point" function (Step 5 of the tutorial).
- Campers can test their project by going into Minecraft and calling the command "/ty spawnpoint". They should see a gold block at the location they are pointing at.
- Campers will watch a short video that explains how to deactivate mods in Minecraft.
- Explain to campers that deactivating (turning off) old mods prevents them from interfering with new mods.
- To turn off a mod, campers need to click the "deactivate" button.
- Cap and Janet talk about variables, parameters, and functions with and without parameters.
- Campers are provided examples of functions with and without parameters. They'll also learn how to specify their own function parameters.
- Remind campers that variables are value (or piece of information) that is stored by a computer program.
- Campers will follow step-by-step directions to learn how to setup a "Capture the Flag" Minecraft game.
- Coding activities include creating variables for game objects, using functions to create different spawn points for both teams (teams "gold" and "iron"), spawning a sheep as the "flag", and creating a command to start the game.
- Page 2 of the tutorial includes a list and description of the different variables. For example, the "gold spawn" variable stores the gold team's spawn location.
- Pages 7-8 include bonus activities with ideas and code block examples of how campers can expand on their game setup.
- Campers will watch a short video about using Tynker's Skin Editor. Optional: Before you start the video, ask if anyone can explain what a skin is. (Answer: The texture and appearance of Minecraft characters or items)
- Ask campers what skins they might want for their Minecraft character. Optional: Encourage campers to create a sketch of what they want to make.
- After finishing the video, instruct campers to make at least one new skin. For now, they should make a skin and not other resources (like items, blocks, or mobs) because skins must be deployed in a unique way.
- Make sure campers experiment with all the drawing tools at the top of the skin editor, including the paintbrush, the texture brush, and the skin rotator.
- For any campers not interested in making their own skins, allow them to explore the skins in the Tynker community and save one that is their favorite that they want to use.
- When most campers are ready to move on, tell them to check whether they want to use an “Alex” or a “Steve” skin, then download and save their new skin. Inform campers that any time making mods, skins, or items in Tynker doesn’t count against their server time limit.
- Have campers log into their Minecraft accounts at minecraft.net, click on their profile name at the top right, and choose “Profile” from the drop-down menu. Now they can choose whether they were using an Alex or Steve model and upload their file.
- Direct campers back to Minecraft and have them join the Tynker Minecraft server. As soon as they join, they’ll be able to see their new skin if they’ve uploaded and saved it correctly. They can click the F5 key (or the function key with the F5 key on a Mac) to see their skin from third person.
Wrap UpAsk campers to pair up and discuss the following:
- What does it mean to "deactivate" a mod? (Answer: Turn it off.)
- Why should you deactivate a previous mod before activating a new one in Minecraft? (Answer: If multiple mods are running, their code might conflict, causing one or both mods to not work.)