Making a 2D A.I

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

So I am making a game were your the player running from an A.I killer (it’s a kinamaticbody2d.) So first I want to make it so when you touch the kinamaticbody2d it reloads the scene. Then like every A.I I need it to move and I want it to follow the player so if someone knows how to do that I really need to know how to.

What you’re asking is very basic programming, depending how deep you wanna dive in. Regarding your request, there are tons of tutorials out there, like the platformer one from BornCG or Rafa Fiedo which includes enemy ai.
You should start with that. Learning is not a race, it’s a marathon, it takes time… which brings to point number 2, always add details in your question. I don’t know if you plan to do a sidescroller, top down or even 3D (NavigationMesh for pathfinding). Depending on that, the AI has to be programmed differently where top down or ¾ view is the easiest.(Navigation2D)

Wurzelpilz | 2021-07-26 14:55

Also I want to make one that just moves around randomly then if it’s on the player screen it starts moving towards the player. Could you send the source code for that in a comment or answer?

toivocat | 2021-07-28 21:19