I've got the script for pointing towards a set of co-ordinates. But something strange is happening:
I have a turning script after that.whenclicked
setdelta x ▼toitem-1 ▼ofxlocations ▼x positionsetdelta y ▼toitem-1 ▼ofylocations ▼y positionifdelta y=0ifdelta x=0setideal direction ▼to-90elsesetideal direction ▼to90elseifdelta y<0setideal direction ▼to180 + ([atan v] of ((delta x) / (delta y)))elsesetideal direction ▼toatan ▼ofdelta x/delta y
Offline
I see no reason why it would keep rotating, there must be some other script causing interference. This script seems like it works properly.
Offline
You should switch the top value to (atan(x/y) - 180) so that it matches up with Scratch's system of degrees, which goes from -180 to 180 instead of from 0 to 360.
Offline
Wes64 wrote:
I see no reason why it would keep rotating, there must be some other script causing interference. This script seems like it works properly.
Don'[t worry, I fixed it
Last edited by zammer990 (2012-07-22 19:41:51)
Offline
why not create another sprite with a single pixel costume - hide it - make your other sprite point towards it in a forever loop - now simply move the hidden sprite to the desired co-ordinates and the visible sprite will follow the hidden one without all the maths?
Offline
Closed by request.
Offline