2
|
Concentration
When the player clicks on a sun, we want something to happen.
So let's associate a procedure called click
with each turtle.
It can be the same rule for each turtle and, yes,
there is a way to do it using
everyone.
Check.
|
|
Now write the click procedure.
Check.
Of course, it's not quite as simple as that but this is a good start.
|
Before reading on, have a good think about the whole story when the player clicks.
You may like to go back and play the game to help you.
We need to think of the clicks in pairs:
- the first click is easy - just show the hidden shape.
- ah ... but the second click ...
- if the first and second clicks match (and this means we have to remember the last click),
blank out the last and this click
- otherwise, restore both to "suns".
I'm going to use a new turtle word ifelse in the
click procedure.
It works like this:
ifelse it_is_raining [stay_home] [go_out].
Write a line that will change the turtle to its hidden shape if it is a sun,
otherwise change it to a sun.
Check.
I found the turtle word wait very useful.
See how far you can get before proceeding to the next section.
|