Check to see if control pad in not being pressed in direction

Is there a way to check if the mobile control pad is not being pressed in any direction? I’m trying to find it but I can seem to locate or find a way to do it.

Hello, tell me which task you need to solve in the game

I need to check to see if the control pad is not being pressed in any direction, and just in the center. Or maybe if the player has released the control pad and it’s currently in it’s idle state. It’s so can turn off the shooting for the player when the control pad is not being used.

Maybe try something like this,

When Control pad pressed (right,up,down or left) Set COUNTER (shoot) to 1

When COUNTER (shoot) = 1, ((do whatever code for shooting)), Set COUNTER (shoot) to 0

This way if the COUNTER (shoot) = 0, this is a good indicator the Control pad isn’t being pressed.

1 Like

That helps, but when I try to shoot diagonally it doesn’t work sometimes because the cursor on the control pad isn’t touching any of the arrows. Even though it’s set to work in all directions. Is there a way around this?

Another option: give the object physics. Then create a condition when velocity is below say 0.1 m/s. That effectively means stopped. Of course if the object has momentum it’s possible the user is no longer holding control pad. But if object is designed to stop moving upon control pad release, this should work.


That’s exactly what I needed! Thank you! :slight_smile:

1 Like