[Newbies] How to put a delay between Morph movements/changes ?

Nicola Mingotti nmingotti at gmail.com
Wed Oct 23 23:33:22 UTC 2019


Hi,

I would like a Morph to move and then wait a bit, move and wait a bit 
... and so on. I can't get it.

For example, this code works as expected:
------------
1 to: 10 do: [:x |
     Transcript show: ('[{1} -- hello]' format: {x}); cr.
     (Delay forMilliseconds: 500) wait.
     ].
--------------

But once i try to put the Delay between a Morph changes it does not do 
what i want. That is, the morph does all the actions together at the end 
of the loop.

---------------------------
e := PolygonMorph new.
e openInWorld.
e position: 300 at 300.
e heading.
e forward: 50.

1 to: 10 do: [:x |
     e forward: 10.
     (Delay forMilliseconds: 500) wait.
     ].
---------------------

bye
Nicola





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20191023/22684d2d/attachment.html>


More information about the Beginners mailing list