Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Teleporting Enemy

I had almost no experience making Enemy AI, so learning how to create behavior trees was difficult, but not impossible.

Creating the first behavior was the first challenge: making the enemy follow the player. Thankfully my teammates had already created a base enemy with some of the base necessities for all the enemies, like spotting the player and a basic attack function and CanAttack Function I could use. So making the enemy follow the player was a breeze since I could already spot the player. 

The second problem was having the Enemy teleport to the player, this was accomplished by making the enemy get the location from the player and teleport to it, but it would spawn directly into it. By getting the player forward vector and adding some values to it, I got it to teleport in front of the player, and by subtracting it would teleport behind it. 

This would help me later but now the Enemy will teleport constantly to the player so I added a cooldown, by checking the distance to the player I can check if the enemy should teleport in front of the player or behind the player, and with this now I can have my enemy teleport in front or behind the player and attack them when they get close to it.

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.