Need Help with this Code !!!

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Siddharth Pushkar

I am making a 2D platformer in Godot 2d, and along with the main player, I have also made some enemies, 4 of them are ground ones, and 1 is a flying one. I thought of an idea of following the player when it comes too close, and I have first implemented it on the flying, and it worked. Still, for ground enemies, I have put a downwards Raycast2D, which will detect any cliffs and turn the enemy around (didn’t put on flying one coz no need).

Now I thought let’s also implement this following feature to one of the ground enemies as well, so I implemented the same code to the ground one. It worked, but due to that follow code, the code for the “floorchecker” (Raycast2D, which detects cliffs) stopped working and showed an error when the code tries to work.
Can someone please fix this code for me?

I cannot see the images you pasted. May be consider pasting the code as text, with the code snippet button. Same for the error.

p7f | 2020-10-20 14:33