[Newbies] back and forth

karl karl.ramberg at comhem.se
Mon Apr 14 21:24:10 UTC 2008


David H. Shanabrook wrote:
> Trying to get and object to move back and forth in etoys.  Something 
> simple like:
> forward 50
> forward -50
>
> It appears to do nothing.  When I go to the code level and add a wait:
>
> forward 50
> (Delay forSeconds: 1) wait
> forward -50
> (Delay forSeconds: 1) wait.
>
>
> Still nothing.  Any ideas what I am doing terribly wrong?
>
> -david-
Etoys does a little optimization behind the scenes and batch screen 
update in each "tick" of a script together, so the result is no movement.
You can try to do this:

    Player forward 50
    Player heading increaseBy: 180

or use a test tile and a boolean variable:

    movedForward
          true: Player forward -50
                  movedForward := false
          false: Player forward 50
                   movedForward := true

Karl


More information about the Beginners mailing list