[SOLVED]How To Make Enemy AI?

Hi guys as u probably know i am making fps game with the WithThreeJS extension, I managed to make some baddeys that shoot but i also want 2 try to make an AI badguy that chases the player if possible, I whatsoever have no experience with this so pls help or send a vid. (im not doing 3d btw)

Have you searched YouTube for GDevelop enemy AI tutorials?

I did one came up: Que the Game Dev

But hes doing 3d does it work in the same way?

Only 1? Searching for “GDevelop enemy ai” in YouTube I got loads. Here is a selection:

Ty i can use these mechanisms without using 3d?

Actually before u reply let me watch the vids…

1 Like

A basic type of enemy AI could be coded as:

Give the enemy a number of states - “idle”, “wander”, “spot player”, “chase player”, “attack player” - and perform actions based on the state (aka FSM or Finite State Machine):

State    | Actions
-------------------
idle     | check for player. check if state should be changed to wander
wander   | move randomly or according to predefined move patterns (left-right, to a hidden spot etc)
spot     | maybe give some indication of player spotted, like an exclamation mark
chase    | move to player using pathfinder, move left/right, apply force in direction of player etc
attack   | stop movement and play attack animation
1 Like

Thanks so much MrMen u have been answering alot of my problems, i figured out how to use the pathfinding behaviour with the vid u sent me tysm i really appreciate it.

1 Like