logo       

Re: back and forth: msg#00119

lang.smalltalk.squeak.beginners

Subject: Re: back and forth

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise