Why my topdown 2D character slows down when running diagonally along a wall ?

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.

Here are the character’s movement settings

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 :pray:

Hello,

I need clarification:

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?

2 Likes

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.

2 Likes

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.

1 Like

Thank you, thank you for the 1st place trophy…

Anyway, I need to know if the character is a 3D object, a flat plane, or on top of a texture, or the 2D character feature in the UI.

2 Likes

Only when they press UP + LEFT/RIGHT or DOWN + LEFT/RIGHT against the wall the character gets slowed down

It’s from a plugin called PaperZD.
I followed this tutorial to make it

But maybe this person wants to treat it like the old-school RPG movements

Yeah that’s exactly what I want to do.

Another question:

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:

  1. When player is against a VERTICAL wall, disable ← and → .
  2. 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.

1 Like

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

Oh wait, it’s kinda easy. Just use collision events with the wall and a box the size of you, unless PaperZD doesn’t allow it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.