[Newbies] Re: Randomness + Pause/Delay?
bert at freudenbergs.de
Fri Apr 15 09:37:10 UTC 2011
"action" is a script of the red and blue rectangles. You find it in the viewer's "scripts" category for e.g. the red rectangle.
"player at cursor" is a tile of the "AllPlayers" holder. You find it in the viewer's "collections" category. (or type in the search box).
Constructing a complex tile in Etoys goes from the concrete to the more abstract. You start giving specific instructions and then generalize.
So at first, you place that "Red | action" tile in your script. Then you can test if that is working.
Later, you replace the "Red" receiver tile with the "AllPlayers | player at cursor". You drag it from the viewer onto the "receiver pad" of the "Red | action" tile.
Now, instead of always performing the "Red" object's "action", it runs the "action" script of whatever object is the current one inside of the "AllPlayers" holder.
You have to make sure yourself that the objects in "AllPlayers" actually have a script named "action", otherwise an error will occur. The type system of Etoys only prevents that e.g. you drop a color where a number is expected.
This "outside-in" construction of complex tiles works naturally when you "invent" the script yourself step-by-step by experimenting. When you only see the result, it can be perplexing how to construct it. The sequence is executed from left to right, but made from right to the left. That's why for arithmetic expressions there is the little "extend" arrow to the right (but you still need to build nested expressions outside-in).
- Bert -
On 15.04.2011, at 03:32, michael rice wrote:
> I give up. Where (how) do you get the
> AllPlayer's | player at cursor | action tile
> shown at the bottom of the attachment?
-------------- next part --------------
Skipped content of type multipart/related
More information about the Beginners