This file contains the definition of the EnemyData struct and its functions. More...
#include <SDL.h>#include <vec2.h>#include <colliders.h>#include <animation.h>#include <timer.h>#include <particle_emitterpresets.h>#include <chunks.h>Go to the source code of this file.
Classes | |
| struct | EnemyState |
| Enemy state structure. More... | |
| struct | EnemyStats |
| Enemy statistics structure. More... | |
| struct | EnemyResources |
| Enemy resources structure. More... | |
| struct | EnemyData |
| Enemy data structure. More... | |
Macros | |
| #define | ENEMY_MAX 100 |
Typedefs | |
| typedef struct EnemyState | EnemyState |
| Enemy state structure. | |
| typedef struct EnemyStats | EnemyStats |
| Enemy statistics structure. | |
| typedef struct EnemyResources | EnemyResources |
| Enemy resources structure. | |
| typedef struct EnemyData | EnemyData |
| Forward declaration of EnemyData structure. | |
Enumerations | |
| enum | EnemyType { ENEMY_TYPE_PROXY , ENEMY_TYPE_ECHO , ENEMY_TYPE_KAMIKAZE , ENEMY_TYPE_RECHARGE , ENEMY_TYPE_VANTAGE , ENEMY_TYPE_RADIUS , ENEMY_TYPE_SABOT , ENEMY_TYPE_TACTICIAN , ENEMY_TYPE_JUGGERNAUT , ENEMY_TYPE_SENTRY , ENEMY_TYPE_LIBET , ENEMY_TYPE_COUNT } |
| Enemy type enumeration. More... | |
Functions | |
| void | Enemy_Init () |
| [Start] Initializes the enemy system | |
| 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. | |
| void | EnemyManager_Update () |
| [PostUpdate] Updates the enemy management system | |
| void | EnemyManager_RenderClearText () |
| void | Enemy_Render () |
| [Render] Renders all active enemies | |
| void | Enemy_Destroy () |
| void | Enemy_Spawn (EnemyData data, Vec2 position) |
| [Utility] Spawns an enemy of the given type at the specified position | |
| void | Enemy_TakeDamage (EnemyData *enemy, int damage) |
| [Utility] Applies damage to an enemy | |
| void | Enemy_CreateHealthText (Vec2 position, int damage) |
| void | Enemy_UpdateHealthTexts () |
| void | Enemy_RenderHealthTexts () |
| int | EnemyManage_CountEnemyInChunk (EnvironmentChunk *chunk) |
| [Utility] Counts the number of active enemies in a specific chunk | |
Variables | |
| ParticleEmitter * | TacticianBuffEffectEmitter |
| EnemyData * | enemyList [ENEMY_TYPE_COUNT] |
| EnemyData | enemies [ENEMY_MAX] |
| Array of enemies. | |
| SDL_Texture * | Enemy_spawnIndicator |
| Texture for enemy spawn indicator. | |
This file contains the definition of the EnemyData struct and its functions.
| #define ENEMY_MAX 100 |
Forward declaration of EnemyData structure.
Enemy data structure.
Complete definition of an enemy, including type, state, stats, resources, animation data, and function pointers for behavior
| typedef struct EnemyResources EnemyResources |
Enemy resources structure.
Contains pointers to runtime resources needed by the enemy
| typedef struct EnemyState EnemyState |
Enemy state structure.
Contains the current runtime state information for an enemy, including position, movement, collision, and health status
| typedef struct EnemyStats EnemyStats |
Enemy statistics structure.
Contains the configuration values that define an enemy's capabilities
| enum EnemyType |
Enemy type enumeration.
Defines the different types of enemies in the game
| void Enemy_CreateHealthText | ( | Vec2 | position, |
| int | damage | ||
| ) |
| void Enemy_Destroy | ( | ) |
| 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 |
| void Enemy_Init | ( | ) |
[Start] Initializes the enemy system
Prepares all enemy slots as inactive and loads necessary textures.
| void Enemy_Render | ( | ) |
[Render] Renders all active enemies
Iterates through the enemy array and calls each enemy's specific render function if they are active.
| void Enemy_RenderHealthTexts | ( | ) |
[Utility] Spawns an enemy of the given type at the specified position
Creates a new enemy instance based on the provided template and initializes it at the given position. If no position is provided (NULL), a random valid position is chosen.
| data | The enemy data template to use for spawning |
| position | Position vector for enemy spawn location |
| void Enemy_TakeDamage | ( | EnemyData * | enemy, |
| int | damage | ||
| ) |
[Utility] Applies damage to an enemy
Reduces an enemy's health based on the damage amount. Enemies with 0 or less health after damage will be marked for death processing.
| enemy | Pointer to the enemy to damage |
| damage | Amount of damage to apply |
[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.
| void Enemy_UpdateHealthTexts | ( | ) |
| int EnemyManage_CountEnemyInChunk | ( | EnvironmentChunk * | chunk | ) |
[Utility] Counts the number of active enemies in a specific chunk
| chunk | Pointer to the chunk to check |
| void EnemyManager_RenderClearText | ( | ) |
| void EnemyManager_Update | ( | ) |
[PostUpdate] Updates the enemy management system
Handles enemy spawning, despawning, and room transitions. Manages which enemies are active based on player position.
Array of enemies.
Holds all the enemies in the game
Array of enemies.
|
extern |
Texture for enemy spawn indicator.
|
extern |
|
extern |