Preventing diagonal movement

Hello, i’m trying to prevent my character from moving diagonally (similar to games like gameboy Pokémon where the character can only move on 4 directions). Can somebody help me with it? Thank you very much!

Here’s the blueprint of the project:

Hi, i’m new to this community and to UE so i hope i can help.
You can use a branch before AddMovementInput where you check if the other AxisValue (from the other input event) is equal to 0. If true you add the movement.

I attached a screen from one of my project (don’t mind the italian of the event, and the forward vector, just check the axis value logic)

Oh, i see! I’ll try this right now and i’ll tell you if it worked. And thank you!

So, are your characters standing still when you press two directions at the same time? For example, if i press W+D i would want the character to move only upwards but i guess i should put something on the “false” condition node for that to happen, right?

I managed to make this almost happen, if i press W+D the character indeed goes up but if i press W+A it goes down when it should’ve gone up… Here’s the blueprint.

Yes i didn’t want to move at all if you click both input, but if you want to force up or down…,mmm i think it’s because on the AddMovement from the false branch, is setted as X direction, but in true case is setted as Y, they should be the same direction if the input axis value is the same.

Ohh i see! I’ll keep fiddling with the configs until i get what i’m looking for but you definetely helped me a lot, friend! Thank you very much!

Glad to help :slight_smile: Maybe someone has a better solution, but for now it’s a start. Good luck!