Using pathfinding for enemies
Since our scene is AI ready, we can start adding AI characters in order to test what we have done so far.
Shaping our soldier
First, drag the sprite of the enemy character into the scene. For instance, you can use roguelikeChar_transparent 1_21
, which resembles a soldier figure and can be found in the RPG Pack/Characters/Spritesheet/roguelikeChar_transparent 1
folder. You can see it in the following image:
This is the sprite that we will use in this chapter. Once we are in the scene, rename the gameObject
to Soldier
, and set its position to (-0.4,2.25,0
) and its scale to (3,3,3
).
Then, add a circle collider and a rigid body to our soldier by setting the same variable values that we already set in our player
object. The only difference is that we need to set the rigid body's IsKinematic
value to true, since we will be moving the character by a script that doesn't require any input from the player, unlike the player gameObject
. You can see the final settings in...