This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-27 16:00:47

Vinnie232
New Scratcher
Registered: 2013-01-27
Posts: 5

Invisible Tether script needed

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

 

#2 2013-01-27 16:07:21

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Invisible Tether script needed

I suppose something like this would accomplish what you want:
http://i50.tinypic.com/2lk8c2e.gif
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:
http://i50.tinypic.com/2bvbqp.gif
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)


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#3 2013-01-27 16:31:50

Vinnie232
New Scratcher
Registered: 2013-01-27
Posts: 5

Re: Invisible Tether script needed

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

 

Board footer