On 01.05.2009, at 04:03, Roman Zilber wrote:

Hi all,

I am trying to find a way to control speed of motion and can't find it. Here an example:

Script:
repeat 4 times:
do:
Rocket.turn by (90)
Rocket.forward by (100)

All the lines of code executed immediately, I want to have a pause between motions.

The "repeat" block is not meant for animation. As you noticed, it's executed in a single step.

To animate an etoys object, set a script to "ticking" and describe what the object does in any single step. It's an object-centric approach. We're not telling the object "do this, then wait, then do that". Instead, try to imagine what your object needs to do at any single point in time. That is going to be the script. 

To go slowly in a square, we might want to go 20 steps of 5 pixels each, then turn by 90 degrees. So I would make a variable "steps" and then use this script:

MyObj's steps increase by 1
MyObj forward by 5
Test MyObj's steps > 20
  Yes
    MyObj turn by 90
    MyObj's steps ← 0
  No

- Bert -