Core enemy update system. More...
#include <player.h>#include <random.h>#include <enemy.h>#include <enemy_types.h>#include <time_system.h>Functions | |
| void | Enemy_Update () |
| [PostUpdate] Updates all active enemies in the game. | |
| void | Enemy_HandleSpawning (EnemyData *enemy) |
| [Utility] Manages the spawning process for an enemy. | |
| void | Enemy_HandleMovement (EnemyData *enemy) |
| [Utility] Handles enemy movement physics and velocity calculations. | |
| void | Enemy_TryMove (EnemyData *enemy, Vec2 movement) |
| [Utility] Attempts to move the enemy by the given vector, checking for collisions. | |
| void | Enemy_HandleDeath (EnemyData *enemy) |
| [Utility] Handles the death of an enemy. | |
Core enemy update system.
Manages updates for all active enemies, handling state changes, movement physics, collision detection, and AI activation.
| void Enemy_HandleDeath | ( | EnemyData * | enemy | ) |
[Utility] Handles the death of an enemy.
Sets health to 0, marks as dead, and removes collision. Called when an enemy's health reaches zero or when they spawn inside another object.
| enemy | Pointer to the enemy that died |
| void Enemy_HandleMovement | ( | EnemyData * | enemy | ) |
[Utility] Handles enemy movement physics and velocity calculations.
Implements a complex movement system that decomposes velocity into forward and lateral components to apply different physics rules to each, then recombines them.
| enemy | Pointer to the enemy to move |
| void Enemy_HandleSpawning | ( | EnemyData * | enemy | ) |
[Utility] Manages the spawning process for an enemy.
Handles the 1-second delay between the appearance of the [+] indicator and the enemy actually spawning. Also checks for collision at spawn point.
| enemy | Pointer to the enemy being spawned |
[Utility] Attempts to move the enemy by the given vector, checking for collisions.
Tries to move an enemy to a new position but cancels the movement if a collision would occur with walls, the player, or other enemies.
| enemy | Pointer to the enemy to move |
| movement | Vector representing the attempted movement |
| void Enemy_Update | ( | ) |
[PostUpdate] Updates all active enemies in the game.
Main update loop for all enemies in the game. Skips dead enemies, handles special states like spawning, and processes movement and death conditions for each enemy.