Draft
Conversation
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!
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.) |
Member
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!