Simultor frameworks for Squeak

Hannes Hirzel hirzel at spw.unizh.ch
Mon Jul 23 21:09:44 UTC 2001


In addition to the many things already mentioned 
I think one should as well say that Morphic as it is now is a simulation
framework. 

The class Morph contains the method

wantsSteps
	"Return true if the receiver overrides the default Morph step
method."
	"Details: Find first class in superclass chain that implements
#step and return true if it isn't class Morph."

	| c |
	self isPartsDonor ifTrue: [^ false].
	self player wantsSteps ifTrue: [^ true].
	c _ self class.
	[c includesSelector: #step] whileFalse: [c _ c superclass].
	^ c ~= Morph


So to make that your morphs get sent the message #step to them regularily
you just have to implement
#step 
and 
#stepTime
in the subclasses of Morph you are working with.

The number you give back in #stepTime is in milliseconds.

An example for this in the image is the BouncingAtomsMorph.
It serves as a simulation of an ideal gas.
Bring up its halo and you see that it as well serves to simulate
infections (menu entry: 'start infection').

On another context this #step / #stepTime mechanisms makes it 
easy to do animated presentations.


Hannes Hirzel





More information about the Squeak-dev mailing list