Hey, so I’m making a top down 2D game where the character is 2D but the world is 3D.
Currently, I got this 8-directional sprite character, you can use WASD to walk (600 cm/s max speed and 2500 max acceleration) and you can also press shift to run (950 cm/s max speed 800 max acceleration). You can also move the topdown camera with your mouse.
Also this is blueprints for the WASD/Sprint movement (Sorry if it looks messy I’m a beginner)
Now, the actual issue, I’m making a horror game with chase aspects to it, and I want the chases to be fast paced, my problem is when my character runs diagonally it gets slowed down by the wall. You can watch a video [here]
This can get frustrating because you can get stuck during chase and it will make the gameplay feel clunky (example)
I tried lowering the ground friction which works BUT the gameplay feels like I’m running on ice.
I want something like Undertale when you walk diagonally towards a wall it makes you walk along with it
What I think Undertale has is when you are moving in a direction (Let’s pretend it’s left) once you hit a wall in your left, your character simply stops moving, so when you are pressing Up Left for example, once you hit a wall the Left input is ignored and only the Up input is affecting the character.
I want to recreate that mechanic, any help is appreciated
If the player is against the wall and they press UP or DOWN, the character moves just fine? But if they are against the wall and they press UP + LEFT/RIGHT or DOWN + LEFT/RIGHT, you encounter the issue?
You should keep that to tell the player not to run into walls. Just saying. That is probably because it generates collisions too many times. Scratch is a good example of this.
You beat me to it. I was going to say that this is a usual feature in virtually all games. But maybe this person wants to treat it like the old-school RPG movements, in which case, maybe the LEFT/RIGHT inputs need to be ignored when touching a wall.
That’s why I waited for them to give me the specific input.
When the character is running alongside the TOP and BOTTOM walls, is the issue the same, but shifted? Where they only slow when LEFT + UP/DOWN or RIGHT + UP/DOWN are pressed?
If so, then you can have a condition like:
When player is against a VERTICAL wall, disable ← and → .
When player is against HORIZONTAL wall, disable ↑ and ↓.
You can place a BOOLEAN between your X and Y inputs that gate-checks for any OVERLAP EVENTS.
You can place a COLLISION BOX around your character, and when that box comes in contact with a wall it will adjust the BOOLEAN value.
You’ll just need to make sure your walls are blueprinted to be HORIZONTAL or VERTICAL.
Okay, I get it. If you want the character to keep moving fast, then remove input left or right when hitting any walls, and vice versa. I am gonna figure out how to do that