0 votes

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?
My enemy code

The Error I am getting

in Engine by (40 points)

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.