[Newbies] isStepping question
bert at freudenbergs.de
Sat Nov 7 13:30:00 UTC 2009
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 -
More information about the Beginners