Bionic arm/Grappling hook

For questions about using Classic.

Post » Sun Aug 16, 2009 4:43 am

I take that back, I really have no idea what I'm doing. What the heck is qarp anyway? Well, yeah. I looked it up and it's Quadratic Interpolation, but then what's that? How do I even use that? This is so confusing.
B
2
S
2
G
4
Posts: 153
Reputation: 1,756

Post » Sun Aug 16, 2009 5:13 am

I don't think qarp is necessary, but it does use a small bit of math. For a basic grapple hook all you really need are three variables; 'distance', 'angle', and 'speed'. When your grapple first latches on you set the 'angle' value to the angle between the grapple point and the character and set 'distance' to the distance between these two points.

Every tick that the character is latched, add something like this to 'speed':

[code:2twkufci]180 * cos(GUY('angle')) * TimeDelta[/code:2twkufci]
Then, add this to your angle value:

[code:2twkufci]GUY('speed') * TimeDelta[/code:2twkufci]
After that, it's a simple matter of setting the position of the grappling object to:

[code:2twkufci]X: GrapplePoint.X + cos(GUY('angle')) * GUY('distance')
Y: GrapplePoint.Y + sin(GUY('angle')) * GUY('distance')[/code:2twkufci]

If your character first grappled onto something at a 45 degree angle from the grapple point, he would swing endlessly between 45 and 135 degrees; at 10 degrees, between 10 and 170 degrees; etc...

Simple pendulum example

I hope this helps with the basic concept to some degree. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sun Aug 16, 2009 5:22 am

[quote="linkman2004":29rdx3zh]I don't think qarp is necessary, but it does use a small bit of math. For a basic grapple hook all you really need are three variables; 'distance', 'angle', and 'speed'. When your grapple first latches on you set the 'angle' value to the angle between the grapple point and the character and set 'distance' to the distance between these two points.

Every tick that the character is latched, add something like:

[code:29rdx3zh]180 * cos(GUY('angle')) * TimeDelta[/code:29rdx3zh]
Then, add this to your angle value:

[code:29rdx3zh]GUY('speed') * TimeDelta[/code:29rdx3zh]
After that, it's a simple matter of setting the position of the grappling object to:

[code:29rdx3zh]X: GrapplePoint.X + cos(GUY('angle')) * GUY('distance')
Y: GrapplePoint.Y + sin(GUY('angle')) * GUY('distance')[/code:29rdx3zh]

If your character first grappled onto something at a 45 degree angle from the grapple point, he would swing endlessly between 45 and 135 degrees; at 10 degrees, between 10 and 170 degrees; etc...

Simple pendulum example

I hope this helps with the basic concept to some degree. :)[/quote:29rdx3zh]

Thanks, that makes it a bit clearer. I'm going to try messing around some more, hopefully I can work this out.
B
2
S
2
G
4
Posts: 153
Reputation: 1,756

Post » Sun Aug 16, 2009 8:29 am

[quote="linkman2004":1h2fxlwy]

Every tick that the character is latched, add something like:

[code:1h2fxlwy]180 * cos(GUY('angle')) * TimeDelta[/code:1h2fxlwy]
Then, add this to your angle value:

[code:1h2fxlwy]GUY('speed') * TimeDelta[/code:1h2fxlwy]
[/quote:1h2fxlwy]

This places the sprite in the same starting position. How do you figure the angle to start for its current position?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sun Aug 16, 2009 2:46 pm

[quote="newt":adu5j29w]This places the sprite in the same starting position. How do you figure the angle to start for its current position?[/quote:adu5j29w]

How do you mean? The angle to start is specified when you first grapple on. Those first two values are simply added to the 'angle' and 'speed' values every tick. The first expression increases the speed proportionately to the steepness of the 'angle' value, while the second expression increases the 'angle' value by the 'speed' value.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sun Aug 16, 2009 3:15 pm

I think I see what I did, I was changing the objects angle to get the angel for the bullet. Ill need to add a dummy for the shooting looks like.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Aug 18, 2010 4:13 am

Has anyone made a more complete example of this?

I would love to check it out, it may help with my rope ideas for "Down".

Since hinges are broken at the moment, I am trying to find an alternative solution.

Thanks in advance.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Feb 15, 2016 2:12 am

is there a video tutorial of one, a link to it would be great
B
2
Posts: 6
Reputation: 160

Post » Mon Feb 15, 2016 8:20 am

@TheRedFireMan

TheRedFireMan wrote:is there a video tutorial of one, a link to it would be great


This thread is nearly 6 years old and is for the now retired Construct Classic software.

Did you intend to post here?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,842
Reputation: 48,285

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 10 guests