Bionic arm/Grappling hook

This forum is currently in read-only mode.
0 favourites
  • Please someone help me. How the heck do you make a grappling hook, like in Bionic Commando? I don't want anything fancy like realistic rope physics or anything. Just a simple grappling hook like Bionic Commando that shoots diagonally and connects to a wall allowing you to swing forward (and can also shoot upwards to cling to ceilings).

    The thing is that I am really stupid and I can't figure out how to do things on my own worth a damn and this obviously requires some math which is something I fail at.

    I have an amazing idea for a game that absolutely requires a grappling hook. The thing is I can't even get started on it because I can't even figure out how to make a grappling hook in the first place. An example or a .cap file would be nice. Anything to give me an idea of what I'm supposed to do.

  • Id say probably the easiest way would be to use the line object.

    I would try something like using a dummy sprite with the bullet behavior, then when you spawn the bullet, spawn a line at the same time, and have the start points set to an always event on the grappling gun. Then in the same always event have the endpoints of the line set to the bullet x,y.

    When the bullet hits something destroy it and you will have your rope.

    Now for the character movement you could do something like:

    sprite set position to lerp(line.endx, sprite.x, somethingtimedelta), lerp(line.endy, sprite.y, somethingtimedelta). That will make it climb the rope, you can come up with some other movements like swinging from there.

    edit:

    Ok dont destroy the bullet, just deactivate, and reverse line end x,y with sprite x,y in the expression.

    I always get that messed up.

    Any way heres a cap:

    http://dl.getdropbox.com/u/666516/grapling.cap

  • Yeah, but the actual swinging part. Doesn't that require some advanced math? Honestly I've almost dropped out of school because of math, I really suck at it.

    I mean, I remember someone mentioning this to me once:

    http://en.wikipedia.org/wiki/Pendulum

    And it has some sort of.. I don't even know what that is. Calculus? I never got that far in math. So this is like greek to me.

    Or am I overthinking things a bit too much here?

  • It depends on how complex you want it. For example, if you want your current speed to be transferred to your swing speed upon grappling, it takes a bit of complex math. However, a simple going back and forth is rather simple. I'm currently working on an example of the former.

    EDIT: Also, just thought I'd mention; I don't think I have my original example anymore, but it was kind of crappy anyways, so it needed to be redone.

  • Not really, that is if you understand quarp at least. One way is to add a couple more dummies, and set one to rotate around your sprite, then have another to sit on the end of that sprite. You can then have the main sprite move to quarp(.x,line.endx,dummy2.x, somethingtimedelta).... ehh check the cap again i set it up.

    Any way the timing is a bit off, and you probably need to have the rotation behavior only activate when its shooting, but you get the idea.

  • It's not that difficult to make a NES style BC swing, but there are tons of ways of doing it. Since no physics or pseudo-physics are used, all you have to do is set up a rope object which shoots out of you, then rotate your grapple sprite around the grappled point, while setting your character to an image point on the other side of the rope. It requires no math! (but you will have to set up a few variables to determine swing length and swing speed, also a grappled state for your character.)

  • Yeah, I played Bionic Commando NES and Bionic Commando Reamed again today and I noticed something I never noticed before.

    The character swings forward the same amount of distance forward no matter how far you swing. Even swinging with a really short, almost retracted arm, kickstarted with the shotgun in BCR causes the character to swing forward at the same distance.

    Something like that probably wouldn't be so hard to do after all. I think I have a better idea of what to do now, thanks everyone. I'm going to fiddle around with it some more and see what I can come up with.

  • It's not that difficult to make a NES style BC swing, but there are tons of ways of doing it. Since no physics or pseudo-physics are used, all you have to do is set up a rope object which shoots out of you, then rotate your grapple sprite around the grappled point, while setting your character to an image point on the other side of the rope. It requires no math! (but you will have to set up a few variables to determine swing length and swing speed, also a grappled state for your character.)

    Huh?

    An example?...Please.

  • There's also the apply elastic force action in the physics behavior

  • > It's not that difficult to make a NES style BC swing, but there are tons of ways of doing it. Since no physics or pseudo-physics are used, all you have to do is set up a rope object which shoots out of you, then rotate your grapple sprite around the grappled point, while setting your character to an image point on the other side of the rope. It requires no math! (but you will have to set up a few variables to determine swing length and swing speed, also a grappled state for your character.)

    >

    Huh?

    An example?...Please.

    Actually, I wouldn't mind one either. I think I get the idea though (keyword being I think) but seeing it in action would help.

  • 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.

  • 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':

    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...
    
    [url=http://dl.getdropbox.com/u/917406/grappleHOOK.cap]Simple pendulum example[/url]
    
    I hope this helps with the basic concept to some degree.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    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...
    
    [url=http://dl.getdropbox.com/u/917406/grappleHOOK.cap]Simple pendulum example[/url]
    
    I hope this helps with the basic concept to some degree. 
    

    Thanks, that makes it a bit clearer. I'm going to try messing around some more, hopefully I can work this out.

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

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

    This places the sprite in the same starting position. How do you figure the angle to start for its current position?

  • This places the sprite in the same starting position. How do you figure the angle to start for its current position?

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)