I used the TopDownMovement bahavior to make a Bomberman clone and I make the players slide on the edges of obstacles. I think this can be reused for other games so I would like to make it an extension.
The code is too long to be screenshot, but here the logic:
- The player moves.
- For every obstacle in collision, it checks if the player is on the edge and which direction allows to bypass it.
- If there is no inconsistency on the direction to take, it simulates a key to move in that direction.
The source is in this topic as a PoC (PlayerMovement external events):
But to do so, I would need to access to the obstacles. According to this thread, the feature may exist one day:
The built-in behaviors PlatformerObject/Platform do what I would like to do but this is only possible for bulit-in behaviors, right?
Maybe this is enough common a behavior to be integrated with the TopDownMovement?
I can work on merge request if a maintainer thinks it could be useful.