• Home
  • basic
  • loops
  • while loops
  • if statements
  • variables
  • functions
  • arrays

TASK

Place your turtle on the starting point and program it to reach the end of the path while destroying obstacles, avoiding obstacles (both basic and challenging) and finally building small bridges.

DESCRIPTION

Functions involve storing numerous lines of code into word based shortcuts that you can call at anytime. This decreasing the amount of code required, making your code more efficient and easier to understand/complete. eg: function avoidbedrock()
if turtle.dig() = false do
turtle.up()
turtle.forward()  
turtle.forward()
turtle.down()
end
end

Now instead of writing this complicated code numerous times you can just write avoidbedrock() as if it was a normal line of code such as turtle.forward().
*NEW CODE* The new object (orange stained glass) will be placed both in your inventory and on the course. Just like bedrock it is also undigable so you will need to avoid it. For this we will compare whats in your inventory with the object infront of your turtle and if  they match the code will continue like so; 
function avoidstainedglass()
if turtle.compare(1) = true then
turtle.up()
turtle.forward()
turtle.forward()
turtle.down()  
end
end

Using this and other lines of code you have learn’t complete the course.


MAP

Picture

Minecraft Turtle Codes

Picture

AC DIGITAL

Proudly powered by Weebly
  • Home
  • basic
  • loops
  • while loops
  • if statements
  • variables
  • functions
  • arrays