|
Method 1: Use a textbox.
to reset
setscore 0
everyone [st]
end
to go
resett
everyone [st forever [fd 1 / 3]]
when [score = 20] [announce (se [You clicked all 20 balls in] timer / 10 "seconds!) stopall]
end
to touch
ht
setscore score + 1
end
|
|
| | Click go to set the balls in motion. How fast can you click all 20 turtles to make them vanish? The instruction for each turtle is touch. |
|
Method 2: Create a variable with make.
to reset
make "score 0
everyone [st]
end
to go
reset
resett
everyone [st forever [fd 1 / 3]]
when [:score = 20] [announce (se [You clicked all 20 balls in] timer / 10 "seconds!) stopall]
end
to touch
ht
make "score :score + 1
end
|
|
Note: These projects also demonstrate the use of a timer in a game. See How do I set up a timer in a game? for more information.
|