Newbie question about moving morphs programmatically

Anders Conradi beque at telia.com
Sat Sep 25 16:47:44 UTC 2004


On lördag, sep 25, 2004, at 18:10 Europe/Stockholm, Josh Gargus wrote:

> Try add the method
>
> wantsSteps
>
> 	^ true
>

Thanks. But I am afraid that doesn't solve my problem.

The problem isn't that the morph doesn't move, it is that it moves in 
the wrong direction. Exactly which wrong direction is determined by the 
morph's orientation. Sorry that I wasn't clear enough.

> Joshua
>
> On Sep 25, 2004, at 10:59 AM, Anders Conradi wrote:
>
>> 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