[Etoys] EToys question -- clearly I'm missing some key concept

Bert Freudenberg bert at freudenbergs.de
Tue Jan 23 13:57:08 EST 2007


Am Jan 23, 2007 um 19:01  schrieb Steven Greenberg:

> Hi.  I would like to use EToys for a project but I'm having a hard  
> time adding my own actions.  I suspect that I am missing something  
> obvious, and would appreciate any pointers you could offer.  I've  
> tried to RTFM, but I can't find the FM so I'm kind of stuck.
>
> So... As a test case, I decided that I would make some simple  
> methods to animate the opacity of a Morph.  I also wanted to add an  
> instance variable and manipulate it.
>
> So I created a subclass of Morph and, on the class side, added:
>
> additionsToViewerCategories
>
>     ^ #(
>         (#seg
>             ( (slot grink  'grink is a nonsense variable' String   
> readWrite Player getGrink  Player  setGrink:)
>                 (command changeOpacityLevel: 'change the opacity  
> level' Player) )))
>
> and I created #getGrink, #setGrink:, and #changeOpacityLevel: on  
> the new subclass of Morph.
>
> When I instantiate the new object and open an etoys viewer, the  
> "seg" category is there but it is empty.

In Etoys you are scripting Players, not Morphs. The Morphs are just a  
costume for a Player. You need to add those methods to class Player,  
and forward them to its costume.

- Bert -




More information about the Etoys mailing list