Or if not, please help figure out what I am doing wrong here. I have been trying to debug the first basic enemy I made for my game for hours, but it always get stuck
I have tried changing the horizontal position of the raycasts, placing them further away from the sprite, as well as closer, but it didn't help. I tried using a CapsuleShape2D instead, but it only made the enemy get stuck more often.
I tried using only one raycast and flipping the entire enemy around with the scale method (I honestly much prefer it over flip_h since it flips the collisions as well), but even with only one raycast, the enemy still gets stuck. It seems like once the enemy finds the ledge and turns around, it interprets the tilemaps as ledges as well? Maybe the tilemap collisions aren't properly configured?
The problem seems to be with the raycasts, I am likely missing something/doing something wrong, because even after disabling the CollisionShape2Ds, one by one, the enemy still gets stuck sometimes. I added a few screenshots, including one of the enemy code, the collision layer and mask for the tilemap and the enemy's collisions as well. Thanks in advance!