I'm making a 2D platformer with an enemy that moves left and right.
It already changes direction when facing a wall, but I would like it to change directions when it's about to fall off from a platform by checking the area near and below it.
Something like this: https://ibb.co/QXGH6Pv