The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hello. So I'm trap in a problem where I want an AI (psycho) that by the time he is in aggressive mode he runs toward the player and if the psycho passed by another psycho who's in idle, that idle psycho will become aggressive.

There's an easier way where to create multiple enemies with different names but it's not efficient

in Engine by (23 points)
edited by

1 Answer

+2 votes

You could add all your psychos to a group. Then, you could check in your _on_area_body_enter callback if the entered body is in the group and also if it's in the aggressive mode.

Here is some documentation about groups: http://docs.godotengine.org/en/stable/learning/step_by_step/scripting_continued.html#groups

by (18 points)
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.