Picture1-1-554x368.png

Rainbow Skies

8-10 yrs old

11-13 yrs old

Art and Design

Computer Science

Math & Economics

This project shows how you can create a rainbow in Minecraft using code and the mathematical equation for a circle.

avatar Submitted By: Minecraft Education

May 2, 2017

Skills

  • Creativity
  • Critical Thinking

Supporting Files

PDF of this lesson


Includes all images and directions to use this lesson plan. Please see attached PDF file.

Learning Objectives

  • Apply the Circle equation to create a rainbow.

Guiding Ideas

  • How can you use the circle equation to create a rainbow?
  • How can you use bot to complete tasks in Minecraft?
  • How do functions work in this project?

Student Activities

This project shows how you can create a rainbow in Minecraft using code and the mathematical equation for a circle.

 

Here's how this project will work:

  • The "create rainbow" function uses the circle equation.
  • The bot places the colored blocks that make the rainbow.
  • You can modify the "rainbow colors" function to change the colors of the rainbow.

 

When this project is run (by pressing the "play" button) it creates a rainbow.

 

Circle Equation

 

You can think of the rainbow as being one half of a circle.

This project uses the equation of a circle to create a rainbow.

 

This animation demonstrates how to calculate the coordinates for a circle with a radius of 20.

The x-values start at -20 and count up by 1.

When the x-values reach 20, the rainbow will be finished.

 

The "create rainbow" function calculates these values for you.

 

What is the Bot?

 

This project also uses a special tool used for building in Minecraft called the bot.

These are the code blocks used in this project that affect the bot:

This block moves the bot to the player's position.

This block saves the bot's current location with the provided name.

This block will return the bot to the named checkpoint.

This block will move the drone in the provided direction, the distance provided.

Here's how the project plots the x-and y-values for the rainbow:

For every x-value:

  • Return the drone to the center of the circle.
  • Move the drone to the right "x-value" steps.
  • Move the drone up "y-value" steps.

 

Once the drone is in position, it places the colored Minecraft blocks by calling the "rainbow colors" function.

 

 

Rainbow Colors

The "rainbow colors" function does the work of placing the colored blocks for the rainbow once the drone is in the correct position.

This function places colors for the rainbow by:

  • Placing 1 colored block at the bot's current location, then moving the bot
  • Placing the next colored block at the bot's current location, and then moving the bot

 

This process repeats for all the colors in your rainbow.

 

This project has already added red, orange, and yellow for your rainbow with this code:

 

Add More Colors

 

Can you modify the "rainbow colors" function to draw all the colors of the rainbow?

These blocks will help you get started:

Change the Rainbow Size

 

It's actually pretty simple to change the size of the rainbow. All you have to do is change the number in the "create rainbow" block.

The function parameter (currently 20) represents the radius for the rainbow that will be drawn.

Change the number to draw a bigger or smaller rainbow.

 

 

Render With a Buffer

 

If you're an advanced coder you get access to cool power ups; like making code faster!

By default the bot tool places blocks one-at-a-time.

By using something called a buffer you can tell the bot to place all the blocks at once.

To use the bot buffer:

  • Use the "start bot buffer" block before all of the bot commands.
  • Use the "run bot buffer" when you want to see the result of the bot commands.

 

Modify the "create rainbow" function to make use of the bot buffer.

Your code might look like this:

 

 

 

 

 

 

<img src="https://education.minecraft.net/wp-content/uploads/Picturelastrainbow.png" alt="" width="975" height="538" class="alignnone size-full wp-image-95766" />

 

Performance Expectations

To see the full lesson with images to guide your work, download the attached PDF. Thanks!

Skills

  • Creativity
  • Critical Thinking

External References

Supporting Files

PDF of this lesson


Includes all images and directions to use this lesson plan. Please see attached PDF file.

如果你想了解在中国发行的Minecraft我的世界教育版,请访问我们的中国官方网站. 你也可以留在 education.minecraft.net了解世界其他地方如何使用Minecraft: Education Edition.

或留在