1. This program draws a round track, and positions the turtle on the starting line:
dot gold, 400 dot erase, 200 pen blue, 10 bk 200 pen null fd 50 rt 90
The functions used are: dot
,
pen
, bk
, fd
, and
rt
.
Can you figure out how each of them work?
2. This will let you race the turtle around the track using arrow keys: (Add this code to the end)
speed Infinity tick 60, -> if pressed "up" then fd 2 if pressed "left" then lt 1 if not touches gold write "Game Over" tick null
The indenting is important, because it puts indented
code under the control of a command.
tick 60, ->
if
controls
the code indented under it.
speed
sets the speed of the turtle.
tick 60, ->
sets a timer to run a subprogram
60 times per second.
pressed "up"
checks if the up-arrow key is pressed.
touches gold
checks if the turtle touches that color.
write "Game Over"
shows the quoted text.
tick null
turns off the timer.
Q1: ____________________
Q2: ____________________
________________________
Challenge 1 done: ____
Challenge 2 done: ____
Challenge 3 done: ____
Challenge 4 done: ____
3. Questions and Challenges: