[1/1] Adjust player collisions while walking on bridges#2174
Conversation
a0bd360 to
99b83ad
Compare
|
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.) |
|
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. |
|
@wjt nice! I think a better approach to the "hidden alternative tiles" will be very much welcome. Besides, grapping, I was able to walk back into the void:
|
|
Working on making it interact better with grappling I realised I can't make it depend on |
npc_bridge.webmOK that wasn't so har. |
|
Maybe this can be fixed by making the "is a bridge" box a bit smaller, rather than having it be right up against the edge of the tile… |
99b83ad to
bb987c0
Compare
|
I started building a gym with all the (literal) edge cases and found still more with bridges at corners. Need to finish adding all the combinations of these, tomorrow... What's hard is that cliff edges protrude into the visually-walkable area of the clifftop. |
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. The void was previously non_walkable_floor, like water, but because it sits conceptually over the world, the player shouldn't be able to walk across it while on a bridge. (This is contradicted by the closing cutscene of quest_001 but is otherwise always the case.) Define yet another layer, "void", and move void collisions to that. Update the player's collision_mask accordingly. 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. Teach the guard to walk across bridges. Add a new bridge gym scene for testing. Thanks to Lilith Duncan for helping me think through better approaches to elevation and bridges!
bb987c0 to
d8b1ea2
Compare



Stack:
Adjust player collisions while walking on bridges
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.
The void was previously non_walkable_floor, like water, but because it
sits conceptually over the world, the player shouldn't be able to walk
across it while on a bridge. (This is contradicted by the closing
cutscene of quest_001 but is otherwise always the case.) Define yet
another layer, "void", and move void collisions to that. Update the
player's collision_mask accordingly.
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.
Teach the guard to walk across bridges.
Add a new bridge gym scene for testing.
Thanks to Lilith Duncan for helping me think through better approaches
to elevation and bridges!