0 votes

I'm making an enemy that lunges at the player. I have the enemy looking at the player when it's sitting, but it continues to look even when lunging. I want to know how to stop the look_at() function when moving.

in Engine by (103 points)

1 Answer

+1 vote
Best answer

Create a boolean in which you can flip the switch on and off. You can do this by either

var can_look = true

if can_look == true:

And then on your lunging function , add this:

can_look = false

and on the sitting:

can_look = true
by (385 points)
selected by

This worked like a charm, thank you! I didn't even think of using a bool.

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.