Skip to content

Enemies

Bina Mircea edited this page Jan 14, 2023 · 3 revisions

Enemies

Enemies have 2 main components: behaviours (the enemy AI) and animations

Behaviours

Behaviours tell the enemy what to do at a given time:

  • Patrol selects a random spot at a given distance from the enemy and uses A* pathfinding to move towards it. A new spot is chosen every X seconds.

  • SmartChase finds the player and uses A* pathfinding to move towards it. There was a Chase behaviour without A* pathfinding but was removed.

  • PatrolAndActivate starts as the patrol behaviour but changes to the "Activated" behaviour when the player is seen.

  • ChaseAndShoot uses a SmartChase to move towards the player. When the enemy is in shooting range and it has a clear shot at the player it stops moving and begins shooting.

Actual enemies

Each enemy has Health, Movement and Animator components.

Bat Enemy

Patrol until the player is seen, then start chasing. It has damage on collision.

It has 3 animation states: normal, chasing (activated when player is seen), and dead.

! Bat enemies can fly over objects (tables, chests, etc) so they have a special a* graph

Bat_Sprite_Sheet

Fire Elemental Enemy

Patrol until the player is seen, then start chasing and shooting when in range. It has damage on collision and shooting scripts.

It has 4 animation states: normal, moving (activated by velocity), shooting, and dead.

Fire Elemental Sprite Sheet

Clone this wiki locally