back and forth

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

back and forth

bravo12
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-





_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: back and forth

David Mitchell-10
Have you started the script ticking (clicked the little clock icon)?



On Mon, Apr 14, 2008 at 2:00 PM, David H. Shanabrook
<[hidden email]> 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-
>
>
>
>
>
>
> _______________________________________________
>  Beginners mailing list
>  [hidden email]
>  http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: back and forth

Karl-19
In reply to this post by bravo12
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
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners