Introduction
I create a find treasure game. The player can manipulate the turtle to find the treasure.
I use Random
module to assign the treasure to one of the five boxes.
Here is the code snippet.
Turtles
There are five turtles working on the game.
Instructor turtle:
The turtle for provide game instruction.
box turtle:
The turtle for creating the box.
tina:
The turtle who can help you find the treasure.
msg turtle:
The turtle who will tell you if tina find the treasure.
Sally turtle:
The turtle who will introducte the game and tell you how to start the game.
Instruction
Moving: Press 4 arrow keys to move Tina
Check the treasure: Press space to see if the box contains the treasure.
Reflection
It is fun to learn how to control the turtle with a mouse and keyboard. I think the assignment can help me learn the concept of object-orient programming. I think one challenge I met when I designed the game was how to get the position of Tina. I had no idea how to get the position of Tina in the beginning. I started trying to figure it out by looking for examples of the turtle. Finally, I found that there is a document for the turtle on the trinket. It is exciting to solve this challenge.