[Newbies] isStepping question
cwdw01 at earthlink.net
Sat Nov 7 13:45:53 UTC 2009
Wow! That worked. But I'm sorry to hear that morph doesn't support a loop
like I wanted. That sounds restrictive but maybe I just need more time in
world to become squeakified.
Thank you SO MUCH
From: beginners-bounces at lists.squeakfoundation.org
[mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of Bert
Sent: Saturday, November 07, 2009 8:30 AM
To: A friendly place to get answers to even the most basic questions about
Subject: Re: [Newbies] isStepping question
On 07.11.2009, at 14:18, Christine Wolfe wrote:
> If I have a morph that is stepping through some process I know I can
> test for whether or not it is still stepping by using the isStepping
> method. But, how to I put this into a loop so that the next
> instruction doesn't start until the stepping is done.
> Here is my mouseDown code. I want to put something in before the
> last instruction so it doesn't execute until isStepping becomes false.
> mouseDown: evt
> path := OrderedCollection new.
> 0 to: 9 do: [:i | path add: self position + (0@(10 * i))].
> path := path, path reversed.
> self startStepping.
> self owner moveTheGameBall.
Not possible in Morphic (that is one of the major advantages of Tweak).
The canonical way is to test for the end condition in #step. Something
path ifEmpty: [^self stopStepping].
self position: path removeFirst.
path ifEmpty: [self owner moveTheGameBall]
- Bert -
Beginners mailing list
Beginners at lists.squeakfoundation.org
More information about the Beginners