0 votes

Hi Everyone,

I am currently coding one AI Script, i was wondering if you have suggestions to how prioritize differents states ?

I use different Area2D to detect the differents states and a node Timer to periodically force the patrol function. However i want the DODGE STATE be priority over the CHASE STATE.

Let me know your thought

i call the choose_action() in the process together with the movements.

func choose_action():

match state:

states.DEAD:

    queue\_free()



states.PATROL:

    patrol()



[states.CHASE](https://states.CHASE):

    chase()



[states.DODGE](https://states.DODGE):

    dodge()



states.AVOID\_PLANET:

    planet\_dodge()

Example of detector node

func onDetectorbodyentered(body: Node) -> void:

state = states.CHASE

player = body

in Engine by (12 points)

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 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 webmaster@godotengine.org with your username.