Spielerando

Grappling Hook

A grappling hook flies out along the aim, catches the first anchor on its path and pulls the character in while the button is held. Check the whole stretch the hook covers each step so it cannot skip an anchor, set the pull speed instead of adding to it, and fire again only on a fresh press.

Also called: Grapple, Rope hook, Grapple line.

A heron courier in a red cape is hauled through the air over a dark chasm on a taut rope whose hook has just bitten into a stone ring on a far rock spire, in a carved woodblock print style.
Sorrelwick Gorge, an invented rope-swinging adventure. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Grappling Hook" to my game.

What it should do: A hook lets the player cross gaps and pick their own route. It trades the safety of the ground for speed and reach, so catching an anchor has to feel reliable and the pull has to feel the same every time.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> ready
  ready: Hook ready
  flying: Hook flying
  pulling: Pulling in
  retracting: Hook returning
  ready --> flying: button pressed
  flying --> pulling: hook catches
  flying --> retracting: misses or let go
  pulling --> retracting: arrives or lets go
  retracting --> ready: hook is back
```

Use these starting values:
- hookSpeed: 40 units/s
- maxRange: 12 units
- hookRadius: 0.6 units
- reelSpeed: 14 units/s
- arriveDistance: 1 units
- keepMomentum: 0.5
- retractSpeed: 60 units/s

Watch out for these common mistakes:
- A fast hook skips a thin anchor: Tell your AI: check the whole stretch the hook covers in one step against each anchor, not only where the hook ends up.
- Two anchors on one path: Tell your AI: of all the anchors the hook passes in one step, catch the one it meets first along its way.
- Holding the button after the hook comes back: Tell your AI: remember if the button was held on the last tick, and fire only on a new press.
- A wall between the character and the hook: Tell your AI: when something solid is between the character and the hook, let go at once and give no push.
- The pull adds to the speed: Tell your AI: set the speed toward the anchor to the pull speed every tick, never add to it.
- A long aim is a faster hook: Tell your AI: keep only the direction of the aim, scale it to a length of 1, and fix it when the hook is fired.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

A hook lets the player cross gaps and pick their own route. It trades the safety of the ground for speed and reach, so catching an anchor has to feel reliable and the pull has to feel the same every time.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

button pressedhook catchesmisses or let goarrives or lets gohook is backHook readyHook flyingPulling inHook returning
How it runs, as a diagram
  • Hook ready → Hook flying: button pressed
  • Hook flying → Pulling in: hook catches
  • Hook flying → Hook returning: misses or let go
  • Pulling in → Hook returning: arrives or lets go
  • Hook returning → Hook ready: hook is back

Good starting values

ValueStart withWhat it changes
hookSpeed40 units/sHow fast the hook flies out. About three times the pull speed makes the throw feel quick without being instant.
maxRange12 unitsThe farthest an anchor can be from the character. About six body heights is enough to cross a gap but not the whole level.
hookRadius0.6 unitsHow close the hook must pass to an anchor to catch it. A little wider than the anchor forgives a slightly bad aim.
reelSpeed14 units/sHow fast the pull is. About twice a running speed, so the hook is a shortcut and not a teleport.
arriveDistance1 unitsCloser than this to the anchor, the pull ends. It stops the character from pushing into the anchor and shaking.
keepMomentum0.5The share of the pull speed the character keeps on letting go. Half carries it over the edge without making chained hooks too fast to aim.
retractSpeed60 units/sHow fast the hook flies back. It is also the wait before the next shot, so a quick return keeps the player moving.

What usually goes wrong

A fast hook skips a thin anchor

The hook moves in steps. When one step is longer than the anchor is wide, the hook can sit before the anchor in one step and past it in the next, and nothing is ever caught. It happens on slow computers and with fast hooks.

Fix: Tell your AI: check the whole stretch the hook covers in one step against each anchor, not only where the hook ends up.

Two anchors on one path

If the game takes the first anchor in its list that is close enough, the hook can reach through a near anchor and grab a far one.

Fix: Tell your AI: of all the anchors the hook passes in one step, catch the one it meets first along its way.

Holding the button after the hook comes back

A player who keeps holding the button fires again the moment the hook is back, and swings off where they did not mean to go.

Fix: Tell your AI: remember if the button was held on the last tick, and fire only on a new press.

A wall between the character and the hook

The pull keeps pushing the character into the wall, or drags it through a corner it should have caught on.

Fix: Tell your AI: when something solid is between the character and the hook, let go at once and give no push.

The pull adds to the speed

A pull that adds speed every tick makes the character faster the longer it hangs on, and a pull while falling feels weak. The same hook feels different each time.

Fix: Tell your AI: set the speed toward the anchor to the pull speed every tick, never add to it.

A long aim is a faster hook

If the aim comes from a stick or a mouse, a long or diagonal aim can fly faster than a short straight one.

Fix: Tell your AI: keep only the direction of the aim, scale it to a length of 1, and fix it when the hook is fired.

How to check it works

Works well with

Clashes with Coyote Time: A pull that lets go at an edge can leave the character just over the edge, where the grace time of a late jump may start. Start the grace time only from the ground, not from the end of a pull.

Common questions

how do i add a grappling hook to my game

Paste this: Add a grappling hook. A press fires it along the aim, it catches the first anchor on its path, pulls the character in at a fixed speed while the button is held, lets go on arrival, and cannot fire again until the hook is back.

how fast should a grappling hook pull

Start with a pull about twice the running speed. It then feels like a shortcut. Much faster feels like teleporting, and slower than running makes the hook pointless.

should the player keep speed after letting go of the hook

Keep some of it. Half the pull speed here: the character does not stop dead, and a hop over an edge works, but keeping all of it makes chained hooks too fast to aim.

why does my grappling hook fly through thin anchors

The hook moves in steps, and a fast one can jump over a small target between two steps. Check the whole stretch the hook covered in one step, not just where it ended.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it