Enemy AI
Asked Answered
S

3

0

How do you make an enemy AI? I want it to be like this tutorial:
https://kidscancode.org/godot_recipes/4.x/ai/chasing/index.html
But mine doesnt work for some reason. The enemy doesn't detect the player. I have also set the collision layers and masks of the player and the enemy to the same level. There is nothing else in the environment to interact either. Any help would be much appreciated!

Enemy code:

Player code:

Scholium answered 15/3 at 22:37 Comment(0)
O
0

Seeing your code and scene would be helpful, it could be anything.

Originality answered 16/3 at 8:38 Comment(0)
S
0

Originality Yh, sorry my bad. I updated it now btw.

Scholium answered 16/3 at 13:27 Comment(0)
O
0

On your player, which is a characterbody2d, you need to add a collisision shape as direct child (see the yellow warning icon at your player scene root? Move your mouse on it to see the warning).

What is the the rigidbody for?

Originality answered 16/3 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.