For a project I'm working on, a character has hands (a separate sprite than that of his body) that need to act like they are attached to a tether when following the mouse pointer.
I have so far only been able to get the hand to follow the mouse pointer when it is in the given range but the hand just stops moving all together when it goes out of that range and i need it to still move towards the mouse pointer without it exceeding a distance from that certain point. Does anybody know how this could work?
Offline
I suppose something like this would accomplish what you want:
Just substitute the "go to x:0 y:0" block with whatever location the sprite is supposed to be tethered to.
Also, you can change the 50 values to whatever number the distance from the mouse pointer needs to be.
This looks a little buggy in the offline viewer, but it runs fine in Presentation mode, which is how it will look when online. Give me a moment and I'll write a slightly more complex script that won't look buggy in any viewer.
EDIT: This script is a lot more overwhelming than the first, but it has more fine tuned motion, works in any viewer, and is not dependent on your direction, so the hands can point any way without affecting their tether scripts:
The variables CenterX and CenterY indicate where the hands should be tethered to, and the piece "if RoD > 50" can have its 50 values changed to whatever number the maximum distance from the center point the hands can go from is.
Just ask if you have any questions!
Last edited by Kileymeister_test (2013-01-27 16:21:54)
Offline
thank you a lot! the first way actually works perfectly since i need the hand to point towards the mouse anyway. but that's seriously perfect and my game is off to a great start now! that really does help a lot I owe you one! I'm really lucky to have gotten to you so quickly
Offline