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 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.