Sharing scripts (was: RE: etoy space invader tutorial (alpha))

Karl Ramberg karl.ramberg at chello.se
Sun Nov 4 18:20:37 UTC 2001


Stephen Pair wrote:
> 
> > The bullets getting added also is a speed bump as you mention.
> > That's because of the copying of the player, and that involves
> > creating and compiling a player in the image, so that considered it
> > is quite fast:-) But a more elegant solution is crying for
> > implementation. I think a separation of the model and view could
> > be good here, so there was only one bullet model that could
> > have several views. Or something in that direction.
> 
> I think there is a need to be able to have morphs share scripts (like
> instances share a class).  Is there a way to do this in the etoy system?
> 

After I actually looked in the image, not just writing stuff based on
my bad bad guessing :-) 
Player is  a subclass of Model. 
Each etoy scripted object is a subclass of Player with a costume, 
and the costume is the actual morph one can see. 
So the delay in initialization must be that when a new 
copy is launched, first a model instance is initialized, and then the 
morph refered in the costume is initialized.

Karl




More information about the Squeak-dev mailing list