Help Creating Mob A.I

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jaiden

Hey guys, I am working on a project in godot and I need an experienced developer to help me out. I am trying to make mobs for my game their goal is to follow the player once the player is close enough (I got this part working) but, they also need to wonder around the map when the player is not close enough, i.e they need a.i. I do not know how to do this and would really appreciate anyones assistance. Thank you in advance

Your post is a bit sparse on details. 2D or 3D? What node type are you using for your enemy? What type of game are you making? Sidescroller? TopDown? Something else? How exactly do you want the AI to behave? How often shall their change direction? Are they allowed to roam the level freely or restricted to a certain area?

njamster | 2020-06-18 13:36

1: It is 2D
2: Enemy Node type is KinematicBody2D
3: The gameplay all happens in one scene
4: I want the AI to move around on its own and when the player is close enough, I want it to chases the player, but if the player escapes the AI should continue moving around on its own
5: It can change direction at random times and a random amount of times
6: They are allow to roam the level freely as they wish

Jaiden | 2020-06-18 14:23

thank for replying by the way :slight_smile:

Jaiden | 2020-06-18 14:25

:bust_in_silhouette: Reply From: Sinowa-Programming

You could use a randi_range to randomize the locations the ai chooses.

Yeah, that could work, but I need my mobs to be moving around on their own, not choosing one location and remaining and that random location

Jaiden | 2020-06-18 16:10

They wouldn’t have to, you could set it so when they reach that location they wait for a random amount of time and then choose another location.

Millard | 2020-06-18 16:19

Yes you totally are right, the lightbulb went on in my head, I will give it a try and let you all know, thanks for your input!!!

Jaiden | 2020-06-18 16:49