How to disable use of arrow keys

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By FlashSloth

I’m making a platformer and I need to make it so that when the player enters an area , they cannot use the arorow keys to move. (Basically , disable the arrow keys)

I would appreciate it if anyone could help.
Thanks

:bust_in_silhouette: Reply From: 1234ab

the easiest thing would be to add something like this to the top of your movement part (before move_and_slide):

if is_in_your_area:
    return

and then e.g. your move_and_slide won’t be called when is_in_your_area is true effectively disabling the movement of the player (you still need to set the value of is_in_your_area or any other variable you use depending on if the player is in the area or not, there are signals for that)
also, if you share your movement code, we can more precisely say what to put where