landgreen / n-gon

2-d physics rogue-lite platformer shooter
https://landgreen.github.io/n-gon/
GNU General Public License v3.0
143 stars 205 forks source link

Help with game mechanics issue in my game similar to yours #115

Closed MemeCake789 closed 9 months ago

MemeCake789 commented 9 months ago

Hello there,

I am currently developing a game similar to yours and I am facing an issue with the game mechanics. I have created a manager that detects if the player is touching a wall and allows the player to jump while midair. However, there are several issues with this approach. For instance, the player can jump on the side of the wall and get launched into the air, or somehow stand below a wall.

To fix this, I generated a hitbox on top of all the walls, and only allow the player to jump if they are on the hitbox. While this is better, there are still some issues with it. For example, if the player is falling from a high area and lands on the hitbox, they can jump. Or if the player is on the corner of two walls, they also can't jump.

I was wondering if you could provide some insight into how you tackled this problem in your game. Thank you.

Here's the link to the game I'm working on: https://github.com/MemeCake789/Delta

landgreen commented 9 months ago

press T to enter testing mode in n-gon and you can see the outline of the player hit boxes I used If you haven't unlocked Testing mode enter this command into the console to force an unlock: lore.unlockTesting()

essentially I made a small foot hitbox on the player that doesn't trigger from sides. The hitbox isn't perfect at high speeds you can jump off walls and other shenanigans, so I try to limit the max speed in other ways.