0 votes

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.

Godot version v3.2.3
in Engine by (24 points)

1 Answer

0 votes

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:

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

by (291 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.