Make a character move on its own

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LittleMissCat
:warning: Old Version Published before Godot 3 was released.

I’m making an RPG for a class, and I have no idea how to:
1-Make an enemy move on its own
2-Make the enemy move towards the player when they are within a specific radius of each other.
I’m a newbie to Godot, and any help would be greatly appreciated!!

So you basically want to make an AI (Artificial Intelligence.)
Here’s something in the docs
http://docs.godotengine.org/en/stable/learning/features/physics/ray-casting.html?highlight=AI
I also recommend checking out some github projects. To get an idea of how some AIs work.
Here’s Godot’s official demo projects.
GitHub - godotengine/godot-demo-projects: Demonstration and Template Projects
And here’s Dolphin Island 2.
GitHub - janmarcano/Dolphin-Island-2: A game by Jan Marcano and James T. Uses Godot 2.1

lavaduder | 2017-04-28 17:45

Thanks. Useful starting points.

davidpgil | 2017-11-16 19:36

:bust_in_silhouette: Reply From: eons

This is an answer as generic as the question.

For basic movement, you can set simple rules and make it move according those rules.

There are many techniques to detect and follow, that should be part of the mechanics of your game, you can do some basic things easy trying to reproduce your mechanics with code.

For a RPG proper, there is a lot of study and research on general AI, you will need to learn about finite state machines first, then steering behaviours and other stuff, depending always on the design complexity.


An advice, write the basic mechanics on paper (basic, leave extra features for later), draw everything, try to reproduce that with the engine.
Then you will have more clear where you lack of knowledge and what to ask on specific problems.

ps: godot lacks of resources for people starting from zero but there may be a couple of tutorials around for that.

This post while general, was surprisingly helpful to me. Thanks.

davidpgil | 2017-11-16 19:35