[CS] CarEtoy

Volker Nitsch nitsch-lists at netcologne.de
Tue Apr 16 20:29:54 UTC 2002


from preamble:

"Change Set:		CarEtoy
Date:			16 April 2002
Author:			Volker Nitsch

Hi all,
i try to learn squeak by combining etoys with hand-made classes.
currently i have my own coded CarMorph/CarPlayer.
and lots of questions :)

===i can:
make classes with
 CarMorph new openInWorld
have my own menu-adds,
can copy scripts from derived classes in the base,
and have own class-variables 
which gets also copied when i copy the morph.
currently i have some moving-behaviors
and can set a leftColor, rightColor for sensors 
and a streetColor.
most stuff was found in JoystickMorph.

===some cryptic usage notes
to try it, make a CarMorph
 CarMorph new openInWorld
(it looks like a PaintMorph, because i don't 
know how to change image. 
use 'morph-menu/choose new graphics' to find
the car from the squeakworld/building-project.
)
add a script by hand, switch to the Car-menu
and insert something like 'followStreet',
select sensor-and street colors (pipette, the red and green
front-circles), 
the make the script runnable.

====Questions!!!!

i added my stuff in Player subclass: #CarPlayer.
the usual way seems to be: 
add menu-adds to morph, but code in player.
often the player simply sends back to its costume, which seems 
to be the Morph.
everything seems to add its menu-methods to player,
instead of deriving. Is this a better way than subclassing?

also there is a actorState which seems to have something to do with pen.
is this the 'official' place for toy-variables?

and there is 'Player  subclass: #UnscriptedPlayer'.
how would i make a similar team?
plain copy UnscriptedPlayer and derive it from CarPlayer,
or something more elegant?

for morph-copying, is my usage of veryDeepInner: ok?

to set default values, i have CarPlayer>>initialize, 
called by CarMorph newPlayerInstance.
right places?

and how can i access the image of the car
in the scripting-demo?

Player seems to have kind of own namespace for toys.
how does that work? How can i access morphs by their toy-names?

then, can i mark and collect Morphs with texts?
like giving morphs the attribute food' and
look for it? 
Something based on touchesA, but with categories
instead of one specific morph?

can i put the 'food'-morph on the 'collector'-morph and make
it follow for transport?

hmm, and could this stop/step/go - field have a button
'to-front' which puts all ticking morphs to front?

more questions later ;)
funny to learn squeak with this toys :)

Volker
"!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CarEtoy.cs.gz
Type: application/octet-stream
Size: 2961 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020416/68c5397b/CarEtoy.cs.obj


More information about the Squeak-dev mailing list