Hitbox detection?

I am not sure I understand your code, because I don’t know your entire code.


But basically you need to detect the cell the player is in.

Then you check whether the cell underneath it is not air.

Set a boolean marker falling

  • to true when it’s air
  • to false when it’s solid

Where you move the player check falling :

if(falling) 
    playerY++; // or what your variable name is called 

make falling a global variable: boolean falling = false;

Chrisir

1 Like