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.
I'm running the latest Squeak 3.9 image on a Mac, downloaded form squeak.org .
Suggestions?
Regards, Steve
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 -
On 1/23/07, Bert Freudenberg bert@freudenbergs.de wrote:
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.
Hi Bert. Thank you very much for the quick response. Could somebody please point me to a document that describes the relationship between Players and Morhps? I spent some time going through the code and only came away more confused. Is there any (English) documentation on this? There seems to be a bit in French, but my own French is 20 years stale.
Am Jan 23, 2007 um 19:01 schrieb Steven Greenberg:
I'm running the latest Squeak 3.9 image on a Mac, downloaded form squeak.org.
You should be using the OLPC version for doing etoys, which is based on Squeak 3.8. See
http://wiki.laptop.org/go/Etoys
Etoys projects made in Squeak 3.9 are not compatible with OLPC etoys projects and vice versa.
- Bert -
etoys-dev@lists.squeakfoundation.org