Skip to content

Adjust player collisions while walking on bridges#2174

Draft
wjt wants to merge 1 commit intomainfrom
wjt/adjust-player-collisions-while-walking-on-bridges
Draft

Adjust player collisions while walking on bridges#2174
wjt wants to merge 1 commit intomainfrom
wjt/adjust-player-collisions-while-walking-on-bridges

Conversation

@wjt
Copy link
Copy Markdown
Member

@wjt wjt commented May 10, 2026

Currently adding a bridge is tedious and error-prone, because the player
collides with cliff-edges and water - exactly what the bridge is
supposed to be crossing! So we have alternative tiles for water & bits
of cliff which do not have collisions - and worse, in the case of water,
we have a second alternative which only has a bottom collision so that
we can have a pontoon that ends in the middle of the water.

Add two new named physics layers, bridge and bridge_edge. Adjust the
bridges tileset to have bridge shapes along the walkable area of bridges
(including their ends) and bridge_edge on the bits of bridges that the
player should not be able to walk off.

Add an Area2D to the player which detects when the player's feet are
touching "bridge"; while the player is on a bridge, it adjusts the
player's collision_mask so that the player does not collide with wall
(cliff edges) and non_walkable_floor (water) and instead collides with
bridge_edge.

In Fray's End, replace the alternative water and cliff tiles with
regular ones.

To do the pontoon, we need an alternative lower end of bridge tile that
has bridge_edge at its bottom and sides so that the player can't walk
off into the water. This needs to be done manually - annoying but at
least it's on the same layer as the rest of the bridge, unlike the
alternative cliff and water tiles.

Don't update any other levels: using the alternative water and cliff
edge tiles still works correctly, it's just not necessary.

Thanks to Lilith Duncan for helping me think through better approaches
to elevation and bridges!

@wjt wjt requested a review from a team as a code owner May 10, 2026 10:10
Currently adding a bridge is tedious and error-prone, because the player
collides with cliff-edges and water - exactly what the bridge is
supposed to be crossing! So we have alternative tiles for water & bits
of cliff which do not have collisions - and worse, in the case of water,
we have a second alternative which only has a bottom collision so that
we can have a pontoon that ends in the middle of the water.

Add two new named physics layers, bridge and bridge_edge. Adjust the
bridges tileset to have bridge shapes along the walkable area of bridges
(including their ends) and bridge_edge on the bits of bridges that the
player should not be able to walk off.

Add an Area2D to the player which detects when the player's feet are
touching "bridge"; while the player is on a bridge, it adjusts the
player's collision_mask so that the player does not collide with wall
(cliff edges) and non_walkable_floor (water) and instead collides with
bridge_edge.

In Fray's End, replace the alternative water and cliff tiles with
regular ones.

To do the pontoon, we need an alternative lower end of bridge tile that
has bridge_edge at its bottom and sides so that the player can't walk
off into the water. This needs to be done manually - annoying but at
least it's on the same layer as the rest of the bridge, unlike the
alternative cliff and water tiles.

Don't update any other levels: using the alternative water and cliff
edge tiles still works correctly, it's just not necessary.

Thanks to Lilith Duncan for helping me think through better approaches
to elevation and bridges!
@wjt wjt force-pushed the wjt/adjust-player-collisions-while-walking-on-bridges branch from a0bd360 to 99b83ad Compare May 10, 2026 10:13
@github-actions
Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/adjust-player-collisions-while-walking-on-bridges/.

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

@wjt wjt marked this pull request as draft May 10, 2026 11:28
@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 10, 2026

Hmm, this will break grappling across a bridge, because both the grappling logic and this bridge logic adjust the "collide with water" bit. I guess it will need a little more thought about where the player's physics layers should be controlled.

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.

1 participant