Understanding Functions in Coding with Minecraft

Slide Note
Embed
Share

Functions in coding are self-contained sets of instructions that perform specific tasks within a computer program. They allow for code reuse and save time by writing instructions once as a function and calling it whenever needed. This content covers the purpose of functions, how they save time when editing, the difference between loops and functions, creation of functions in code and pseudocode, and coding functions for mini-games in Minecraft.


Uploaded on Sep 17, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Coding with Minecraft 6: Functions

  2. Lesson A: Introduction to Functions

  3. What functions are The purpose of functions in coding

  4. FUNCTIONS A function is a self-contained set of instructions for performing a specific task within a computer program. Most objects have multiple functions associated with them. They allow you to reuse code anywhere you want. You can write the set of instructions once as a function and from then on simply call the function from inside your program whenever you need that task done.

  5. LETS PLAY A GAME: PB & J

  6. LETS PLAY A GAME: PB & J Pseudocode

  7. LEAP OF FAITH MINI-GAME Your mini-game will have three parts: 1. Creating the pool of water 2. Creating the platform 3. Teleporting the player to the top of the platform

  8. How does making something a function save you time when editing? How is a loop different than a function?

  9. What functions are and their purpose in coding To create functions in code and pseudocode How to code functions in a mini-game

  10. Spawn zombie pigs!

  11. Lesson B: Coding with Functions

  12. What are functions? What is the purpose of functions in coding?

  13. ZOMBIE PIG Create another mini-game that instantly transforms pigs into an army of Zombie Pigmen to combat! Our mini-game will have three parts: 1. Creating the Zombie Pigs 2. Creating strange time lapses 3. Setting the gamemode & difficulty

  14. How did you adjust the time of day in the game? What is something you could add to your code to spawn more Zombie Pigmen in an event?

  15. How to create Zombie Pigs To create strange time lapses in Minecraft To set gamecode and the difficulty level

  16. Make a burger using code Take a short quiz

  17. How to create a set of functions to build a burger in Minecraft The importance of the order of function calls Our learning progress with a quiz

  18. BURGER Functions allow you to divide your big projects of code into smaller more manageable pieces. The construction of a burger can also be divided in such a way. Your burger code will have five parts: 1. Creating the Bottom Bun 2. Creating the meat 3. Creating the lettuce 4. Creating the tomato 5. Creating the Top Bun

  19. LESSON C What we learned today How to create a set of functions to build a burger in Minecraft The importance of the order of function calls Our learning progress with a quiz

  20. Your independent project Code with functions to change the Minecraft landscape Build your dream house

  21. LESSON D : GET CREATIVE WITH FUNCTIONS

  22. To take what youve learned about coding to the next level Create your own MakeCode project to build your dream house

  23. INDEPENDENT PROJECT Build your dream house or build a replica of an actual building in Minecraft. Either way, use functions to automate creating as many different sections of the house as possible.

  24. INDEPENDENT PROJECT Come up with something original that meets the following criteria: Creates, or helps to create, a building, temple, monument, or other piece of architecture in Minecraft Provides at least three separate and distinct functions Includes descriptive names that represent what each function does

  25. IDEAS TO CONSIDER Some ideas for functions: Create carpet Create the walls of a room Create a decorative fountain Create a castle turret Level an area of terrain so you have a flat place to build Create a swimming pool Build different levels for a garden or house Build a doorway Dig a basement

  26. MINECRAFT DIARY ENTRY What did you decide to build? Why? 1. Describe each of your three functions and what each of them does. 2. What kinds of building tasks did you decide needed to be done by hand? Why? 3. Include at least one screenshot of your finished building or piece of architecture. 4.

  27. LESSON D WHAT WE LEARNED TODAY To take what you ve learned about coding to the next level Create your own MakeCode project to build your dream house using functions

  28. Learn about iteration Explore ways to make things repeat

More Related Content