Skip to content

Prototype: Grapple to climb#1904

Draft
manuq wants to merge 3 commits intomainfrom
grapple-to-climb
Draft

Prototype: Grapple to climb#1904
manuq wants to merge 3 commits intomainfrom
grapple-to-climb

Conversation

@manuq
Copy link
Collaborator

@manuq manuq commented Feb 10, 2026

Here is a quick branch to check the status of the grappling hook to climb.

This is currently not possible because the grapple collides with walls. Otherwise, the player would be able to reach buttons or pins in a diagonal, making the use of needles less important:

Captura desde 2026-02-10 09-50-38 Captura desde 2026-02-10 09-50-50

Also the player is colliding with walls while pulling. This branch disables the collision with walls while pulling, as it was happening with the non-walkable floor (water, void). And because the grapple ray may start in the middle of the wall (when the player is touching the wall) it kind of works for going up one level. But as you can see, it doesn't work for going down. I added some pins to the needles level to test it:

recording.webm
recording.webm

My initial feeling about this is: trying to do this kind of things into a game that doesn't have actual elevation is hard!

@github-actions
Copy link

Play this branch at https://play.threadbare.game/branches/endlessm/grapple-to-climb.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt
Copy link
Member

wjt commented Feb 10, 2026

Ouch, I hadn't thought of that when I confidently said that it should work... Thanks for doing this experiment.

Another way of stating the complication is:

  • Grappling within an elevation level is allowed
  • Grappling strictly up or strictly down should be allowed (this allows climbing up or down a cliff)
  • But grappling to a point that goes both up and down a level should not be allowed (this forbids the diagonal case in your first screenshot)

As you say, given we don't have elevation at all this is hard!

But another case that is a bit sad: this means that grappling across the water between two raised islands is impossible, e.g. here (quick mockup from stealth level):

image

or at least it should be because there "should" be cliffs below that tile. Actually if you hide the grass there isn't:

image

If you look very very closely at the edge you can see that the tiles below the bridge have a little grey-blue edge while the one with the pin in it does not:

image

but that could be a workaround for grappling horizontally (not vertically) between islands.

@wjt
Copy link
Member

wjt commented Feb 13, 2026

Thinking aloud here. Right now the HookControl has just one RayCast2D that collides with both walls and hookable. I wonder if we could split this up:

  • RayCast2D that detects hookable
  • ShapeCast2D with a narrow segment shape that detects walls

Then we could say: you can grapple only if RayCast2D is colliding with a hookable thing, and the ShapeCast2D is colliding with either 0 walls, or 1 wall, but not 2 walls. This might allow grappling up one level of elevation, but not up then down as in your first screenshot. As I type this: no this won't work because e.g. the top-right corner tile of a cliff is one collider, not two, but you shouldn't be able to grapple across it... OK back to the drawing board!

To test climbing. And also adjust the teleporter area
to a single tile, so the player can't teleport from the
level above.
@manuq
Copy link
Collaborator Author

manuq commented Feb 18, 2026

Thinking aloud here. Right now the HookControl has just one RayCast2D that collides with both walls and hookable. I wonder if we could split this up:

  • RayCast2D that detects hookable
  • ShapeCast2D with a narrow segment shape that detects walls

Then we could say: you can grapple only if RayCast2D is colliding with a hookable thing, and the ShapeCast2D is colliding with either 0 walls, or 1 wall, but not 2 walls. This might allow grappling up one level of elevation, but not up then down as in your first screenshot. As I type this: no this won't work because e.g. the top-right corner tile of a cliff is one collider, not two, but you shouldn't be able to grapple across it... OK back to the drawing board!

This is worth exploring so I'm giving it a try! Today I tried to make it work just with the RayCast2D and then looping through the collisions like this:

var target_area: HookableArea
var walls_count := 0
while ray_cast_2d.is_colliding():
	var obj := ray_cast_2d.get_collider()
	if obj is HookableArea:
		target_area = obj
		break
	walls_count += 1
	ray_cast_2d.add_exception(obj)
	force_raycast_update()
clear_exceptions()

But it didn't work because Tilemap collisions can't be excluded.

@wjt
Copy link
Member

wjt commented Feb 18, 2026

What if you add a custom data layer to the tile set, of type Vector2, that specifies which direction the cliff is pointing? You can get the rid of a collider from the collision result, and convert this to a tile coordinates via a method on the tilemaplayer

@manuq
Copy link
Collaborator Author

manuq commented Feb 18, 2026

@wjt as you imagined the ShapeCast2D didn't work. Basically it doesn't have a way of knowing if the ray (or shape) is trespassing the wall. The custom data layer is an interesting one, I'll explore it!

recording.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments