Create Your Own Computer Game
Things to Try
Week 4
- Experiment with announce and question. Here are the examples:
to over
announce [Game over!]
end
to reply
question [Are you ready? (please answer yes or no)]
if answer = "yes [announce [OK] stop]
if answer = "no [announce [sorry] stop]
announce [oh]
end
- Experiment with timers.
For exampe, suppose you want one character (Mildred) to have a timer:
Mildred, GiveTurtle "time-left
will give Mildred a timer called time-left.
Put
Mildred, settime-left 100
into your startup procedure so that the time is initially set to the right number. (I picked 100; you pick whatever you want.)
- Here are some sample turtle graphics procedures for you to try.
Remember that you can clear your graphics with cg.
to small-square
repeat 4 [fd 50 rt 90]
end
to big-square
repeat 4 [fd 120 rt 90]
end
to design
repeat 12 [big-square rt 30]
end
to square :size
repeat 4 [fd :size rt 90]
end
to squiral :size
fd :size
rt 90
squiral :size + 2
end
to polyspiral :size :angle
fd :size
rt :angle
polyspiral :size + 2 :angle
end