### Actor 'dragging' question

#### TheBasedAbel

• Posts: 24
Ok the behavior I'm trying to make is a behavior that will allow me to spawn a magic chain wherever the user clicks (or taps their finger) that will drag the orb on the bottom of the screen behind the chain that is guided by their finger. (the other stipulation is that their finger has to be below a certain Y value on the screen because I don't want it to be able to be dragged more than ~ halfway up the screen vertically but I can probably figure that part out)

Basically think of a Wrecking ball, when you touch the screen a chain appears and the ball attaches to the chain at the tip of your finger, when you release the chain disappears and the ball drops to the floor, hopefully this will help to explain the physics I'm trying to achieve. I attached a very minimal diagram to also help visualize, thanks for the help i'm stumped!

#### TheBasedAbel

• Posts: 24
can anybody figure this out? I have been working for days and am still stumped!

#### gruffman

• Posts: 564
I suspect maths will be involved here, which is why the response is low!

Ok, so reading where the screen is touched and generating the ball there is likely no problem.

Assuming you have a point somewhere on screen that serves as the thing the chain will be attached to, then when the screen is touched and the ball made, you need to compare the x and y of your finger and the `fix point`. Then draw a line between the two, using the draw line functionality. That's the maths bit...! As long as the line is made in a "when drawing" event, you should be able to move your finger and the line will stay updated and accurate.

If you can do that, then look into generating a sequence of individual chain links across that line would be my suggestion. But do the above first

I think you may have a new issue after the finger is released as i guess you want to capture speed/velocity or angle of release..?

Just my thoughts

Now available for all Android Devices - Happy Face Concentration
My Games To Date
Find A Face / Hero Of Oda / Snakes And Ladders
Hungry Monkey available at fgl.com for Sponsorship
My site - Gruffgames.com