morphic scripting

Ryan Davis zss at ZenSpider.com
Mon Nov 9 08:00:34 UTC 1998


I am learning morphic with the intent of using it to teach my SO's son how
to program. He REALLY wants to program games, but he doesn't have a clue
about it at all, and I thought using morphic in an OO-logo fashion would be
a very nice start...

I'm not familiar w/ morphic at all, so I was happy to see that there is
finally some documentation for beginners out there. Very cool. But I have
some further questions.... (some of these may be obvious to those more
experienced w/ morphic... I'd be happy to collect the results and put them
on someone's swiki)

1) I wrote a method called touches: which is based on some of the logic in
moveTowards: in order to have a test for collisions (which has obvious
value to a 9 year old programmer-wannabe). I am now able to create a cat
and mouse simulation where the cat can catch the mouse and make it attack
(the mouse turns red when touched, the cat makes a noise when it touches).
But the mouse code would be better if he could detect if ANY cat is
touching him... Can it?

checkBleeding
	| blood normal |
	blood _ (Color
				r: 1.0
				g: 0
				b: 0).
	normal _ (Color
				r: 0
				g: 0
				b: 1.0).

	(self touches: (self class refPlayer61)) " <--- here is the problem"
	ifTrue: [
		self setColor: blood
	] ifFalse: [
		self setColor: normal
	]! !


2) I don't understand the model too well... From the debug menu, I learn
that the mouse is an instance of StarMorph. But when I edit one of his
methods it is an instance of a subclass of Player... Is this an analog to
View and Controller?

3) Is there a registry of known players in a given morph? (possibly a
shorter version of #1).

4) I assume that the costumes are akin to sprites? That way I could have
several different costumes for a spaceship or car and have it rotate
through them??? How?

5) Is there some clean way to get all my changes saved to a text file? I
found the save morph, but they are at least partial binary files...

6) Any way to automatically clean or not generate these:

!Player5 methodsFor: 'anonymous scripts'!
xxxScript7
	^ self! !

7) I can name a player in the debug menu, can I have something rename the
class?

           Ryan Davis         -=-    Zen Spider Software
 -=- mailto:zss at ZenSpider.com -=- http://www.ZenSpider.com/ -=-
I know that you believe you understand what you think I said but,
I'm not sure you realize that what you heard is not what I meant.





More information about the Squeak-dev mailing list