• 2D
  • How would I create a grappling hook?

Im trying too create a grappling hook, and this is what I think I should do: preload a texture, then when a player clicks somewhere add a sprite with a collision shape to the scene, set the texture and calculate the vector between player and mouse, and apply to the sprite.

For how to do the sprite you can check out my laser beam example (attached). To make a real grappling hook (or laser beam) that actually hits things you would just add a raycast and use its collision point as the end of the rope (instead of just mouse pos like in my example).

If you're going to use the grappling hook multiple times, it's pointless to add a new sprite and destroy it each time. Just hide it when it's not active.

4 days later

I think @Sakaki worked on something like this recently.