[Newbies] Re: Randomness + Pause/Delay?
bert at freudenbergs.de
Mon Apr 11 10:40:12 UTC 2011
On 09.04.2011, at 13:28, michael rice wrote:
> Here's the Etoys app. Load and press Go button and it will continue game where two players take turns randomly selecting a tower on which to place a blue or red block, each game concluding when both towers are topped with block of the same color.
> As you can see, redAction and blueAction appear to happen simultaneously. Ergo, the wish for a means to delay for a tick or two between the two actions.
The Etoys way would be to do the red and blue actions in alternating ticks. E.g.
However, the *real* Etoys way would be to let the Etoys objects do their work. Your approach is very procedural. It uses many variables and functions instead of objects. It even does the layout in code, calculating x,y coordinates etc.
I am attaching a project that does pretty much the same as yours, but does not need a single variable, and has only 3 simple scripts with about 3 lines each.
- Bert -
-------------- next part --------------
Skipped content of type multipart/mixed
More information about the Beginners