How can I stop the look_at() function?

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

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.

:bust_in_silhouette: Reply From: Mrpaolosarino

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

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

OiKeTTLe | 2021-04-22 07:59