Newbie question about moving morphs programmatically
Josh Gargus
schwa at fastmail.us
Sat Sep 25 20:30:28 UTC 2004
In that case, try
step
| morphToMove |
morphToMove := self isFlexed ifTrue: [self owner] ifFalse: [self].
morphToMove center: morphToMove center + (self localVelocity * (self
stepTime * 0.001))
Explanation:
Rotated/scaled morphs are wrapped in a FlexMorph in order to use BitBlt
to transform the pixels. No one
likes this, and it will go away with Tweak/Croquet.
Joshua
On Sep 25, 2004, at 12:47 PM, Anders Conradi wrote:
>
> 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
|