How to disable arrow keys?

I want the player to be able to move the Character only one step at a time. On screen there is a set of arrows that you can click on, and it works.

But you can also press the arrow keys on the keyboard, and as usual, that moves the Character as long as you hold down the key.

I need to either (a) disable the arrow keys, or (b) make the arrow keys move the Character one step, then stop.

Have you tried to use key released instead of key pressed?

//Farid

You could have a variable ( a boolean one is fine), that is either true or false:
Variable “arrowkeysonoff” is true /false.
You use this variable as a condition for your arrow key actions, so you can choose whenever it works or not.

You can do this if you tween your character instead of moving it with forces. You just need a ‘trigger once while true’ - condition together with the key press.

Seems like there are a lot of replies to this query! In terms of absolutely disabling them, if you are using topdown/platformer mechanics, navigate to the behavior and disable Default Controls. In terms of only moving one step, you could use Key Released as @Farre suggested, or a Trigger Once as @Drona suggested.

I was using “Default Controls” instead of KeyPressed, but now I’m using KeyReleased and it works. Thanks.

1 Like