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

asked Jun 17 in Engine by c6ryl (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.