Newbie question about moving morphs programmatically

Anders Conradi beque at telia.com
Sat Sep 25 14:59:23 UTC 2004


Hi,

I am new to this list, squeak and smalltalk in general. I am sorry if 
this is the wrong list for this kind of questions, but I don't know 
where else to ask.

I have a simple morph that I want to move by a velocity vector 
(expressed as a Point). The velocity is expressed in the global 
coordinate system. What is the proper method for moving the morph? I 
have tried

localVelocity
	^(self globalPointToLocal: self velocity) - (self globalPointToLocal: 
0 at 0).

step
	self center: self center + (self localVelocity * (self stepTime * 
0.001))

and

step
	self center: self center + (self velocity * (self stepTime * 0.001))

In both cases "self velocity" returns the velocity as a Point.

I am sure the answer is really easy to find, but I don't know where to 
look.

Thankful for any answers,
/Anders Conradi




More information about the Squeak-dev mailing list