I NEED MY CAR TO FOLLOW THE MOUSE POINTER
Offline
<when green flag clicked>
<forever>
<point towards( mouse-pointer
<move( --- )steps>
<end>
Offline
MyRedNeptune provided a script that has the car moving at a constant speed toward the mouse pointer, which is probably what football10 wanted. It should include a wait 0.02 seconds in the loop so that it will behave the same on very fast machines as on somewhat slower machines. A lot of people forget to have a wait in each forever loop, then wonder why their program behaves differently on a friend's machine.
There is a simpler script for following the mouse pointer that just jumps to the mouse pointer, tracking it more precisely, but not keeping a constant speed
when green flag clicked
forever
go to mouse-pointer
wait 0.02 seconds
Offline
or you could do:
<when green flag clicked>
<forever>
<go to[ mouse pointer
that makes your sprite just follow the mouse
Last edited by funkymonkey (2007-12-07 21:03:52)
Offline
funkymonkey, your script works, but can result in competition for computer resources with other scripts, since it is trying to update the position all the time. Adding a small wait (up to about 0.1 seconds) does not change the appearance for the user, but allows other scripts more time to do their jobs.
Offline