How can I make a sprite turn when dragged?
Offline
What behavior, exactly, do you want? If you can describe the behavior precisely, you are halfway to programming it.
Offline
I want there for eample to be a knob on a circle, when you drag that knob clockwise the circle turns, but not the oher way
Offline
Relatively straightforward, in fact.
You just need to make your circle, ensure teh centre of rotation is in the middle and the knob is at the "front) (90 degrees by default) and script something along the lines of
If <touching mousepointer> AND <mouse down> point towards <mousepointer>
The tricky thing is that inside the scratch program, it won't work properly because of the built-in ability to drag and drop sprites in the programming window. So to test it you'll need to go to full screen mode.
Offline
Ah - wait - you only want it to turn one way, eg clockwise?
Trickier... you'd need to compare the current direction with the mouse direction to see if the turn is valid... still doable, though.
Last edited by Mayhem (2007-08-06 06:18:12)
Offline
Thanks so much for your help!
Offline