Tutorial 13: Enemy paths


Enemies can have their own patrol routes to roam through the map. It is recommended to create several paths so the enemy can move in a more intelligent way. If you don’t create enemy paths then the enemies will just pursue the player when they see him but they won’t move if they don’t.

Start by creating an enemy skeleton. To do that select Npc/NpcSkeleton and right click to place it in the map. Left click on the enemy and check that the field “useRoutes” is set to “True“. If you set this field to false, then the enemy won’t use any routes in the map.

 

Let’s add navigation points for the enemy. Select Helpers/patrolPoint and right click to add it to the map.

 

Repeat the process to add several patrol points creating a circle (well, some sort of).

 

Now we need to define the navigation direction. Left click on the first patrol point. Then press and hold C (to connect it to other points) and left click on the destination point without releasing the key.

 

Repeat the process to create a full path. Note that the lines are wider at the origin of the route so you can easily see the direction.

That’s it! Now the skeleton (and any other enemy around) will use this route if they don’t see the player. You can use the enemy routes to make them walk through the entire level if you want. Well done!