Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
enemy.h
Go to the documentation of this file.
1
9#pragma once
10
11#include <SDL.h>
12#include <vec2.h>
13#include <colliders.h>
14#include <animation.h>
15#include <timer.h>
17#include <chunks.h>
18
19#define ENEMY_MAX 100
20
22
42
43
64
81
91
95typedef struct EnemyData EnemyData;
96
117
125
129extern SDL_Texture* Enemy_spawnIndicator;
130
131void Enemy_Init();
132void Enemy_Update();
135void Enemy_TryMove(EnemyData* enemy, Vec2 movement);
136void Enemy_HandleDeath(EnemyData* enemy);
139void Enemy_Render();
141void Enemy_Spawn(EnemyData data, Vec2 position);
142void Enemy_TakeDamage(EnemyData* enemy, int damage);
143void Enemy_CreateHealthText(Vec2 position, int damage);
A simple animation system capable of loading a spritesheet with fixed sized frames.
Implements environment chunks that form game maps and rooms.
Defines the collider system for collision detection.
void Enemy_Update()
[PostUpdate] Updates all active enemies in the game.
Definition enemy_update.c:25
void Enemy_UpdateHealthTexts()
Definition enemy_takedamage.c:88
SDL_Texture * Enemy_spawnIndicator
Texture for enemy spawn indicator.
Definition enemy_start.c:22
EnemyData * enemyList[ENEMY_TYPE_COUNT]
Definition enemy_start.c:21
void Enemy_HandleDeath(EnemyData *enemy)
[Utility] Handles the death of an enemy.
Definition enemy_update.c:201
void Enemy_RenderHealthTexts()
Definition enemy_takedamage.c:112
void Enemy_CreateHealthText(Vec2 position, int damage)
Definition enemy_takedamage.c:44
void Enemy_Spawn(EnemyData data, Vec2 position)
[Utility] Spawns an enemy of the given type at the specified position
Definition enemy_spawn.c:26
void Enemy_TakeDamage(EnemyData *enemy, int damage)
[Utility] Applies damage to an enemy
Definition enemy_takedamage.c:28
void EnemyManager_Update()
[PostUpdate] Updates the enemy management system
Definition enemy_manager.c:43
void Enemy_HandleMovement(EnemyData *enemy)
[Utility] Handles enemy movement physics and velocity calculations.
Definition enemy_update.c:119
void Enemy_HandleSpawning(EnemyData *enemy)
[Utility] Manages the spawning process for an enemy.
Definition enemy_update.c:72
void Enemy_Init()
[Start] Initializes the enemy system
Definition enemy_start.c:29
#define ENEMY_MAX
Definition enemy.h:19
void Enemy_TryMove(EnemyData *enemy, Vec2 movement)
[Utility] Attempts to move the enemy by the given vector, checking for collisions.
Definition enemy_update.c:166
EnemyData enemies[ENEMY_MAX]
Array of enemies.
Definition enemy_start.c:20
void Enemy_Destroy()
EnemyType
Enemy type enumeration.
Definition enemy.h:28
@ ENEMY_TYPE_LIBET
Definition enemy.h:39
@ ENEMY_TYPE_TACTICIAN
Definition enemy.h:36
@ ENEMY_TYPE_RECHARGE
Definition enemy.h:32
@ ENEMY_TYPE_ECHO
Definition enemy.h:30
@ ENEMY_TYPE_COUNT
Definition enemy.h:40
@ ENEMY_TYPE_VANTAGE
Definition enemy.h:33
@ ENEMY_TYPE_KAMIKAZE
Definition enemy.h:31
@ ENEMY_TYPE_JUGGERNAUT
Definition enemy.h:37
@ ENEMY_TYPE_SABOT
Definition enemy.h:35
@ ENEMY_TYPE_SENTRY
Definition enemy.h:38
@ ENEMY_TYPE_RADIUS
Definition enemy.h:34
@ ENEMY_TYPE_PROXY
Definition enemy.h:29
int EnemyManage_CountEnemyInChunk(EnvironmentChunk *chunk)
[Utility] Counts the number of active enemies in a specific chunk
Definition enemy_manager.c:25
void Enemy_Render()
[Render] Renders all active enemies
Definition enemy_render.c:25
ParticleEmitter * TacticianBuffEffectEmitter
Definition tactician_start.c:22
void EnemyManager_RenderClearText()
Definition enemy_manager.c:136
Defines preset particle emitter configurations for common visual effects.
Configuration data for creating an animation.
Definition animation.h:102
The main animation structure.
Definition animation.h:83
This struct represents a collider.
Definition colliders.h:96
Enemy data structure.
Definition enemy.h:103
EnemyType type
Type of enemy.
Definition enemy.h:104
void(* render)(EnemyData *data)
Render function.
Definition enemy.h:113
void * config
Enemy type-specific configuration.
Definition enemy.h:110
void(* update)(EnemyData *data)
Update logic function.
Definition enemy.h:112
void(* start)(EnemyData *data)
Initialization function.
Definition enemy.h:111
EnemyState state
Current state information.
Definition enemy.h:105
const char * name
Name of the enemy.
Definition enemy.h:115
AnimationData animData
Animation configuration.
Definition enemy.h:108
EnemyStats stats
Stats and capabilities.
Definition enemy.h:106
EnemyResources resources
Pointers to resources.
Definition enemy.h:107
Enemy resources structure.
Definition enemy.h:87
Timer * timer
Pointer to enemy's timer for cooldowns/behaviors.
Definition enemy.h:89
Animation * animation
Pointer to enemy's animation.
Definition enemy.h:88
Enemy state structure.
Definition enemy.h:50
bool isSpawning
Whether the enemy is in spawning state.
Definition enemy.h:57
float tacticianBuffTimeLeft
Time left for Tactician buff.
Definition enemy.h:62
Collider collider
Collision detection information.
Definition enemy.h:54
float tacticianBuff
Buff applied by Tactician.
Definition enemy.h:61
SDL_RendererFlip flip
Definition enemy.h:59
int currentHealth
Current health points.
Definition enemy.h:55
bool isDead
Whether the enemy is dead.
Definition enemy.h:56
Vec2 velocity
Current velocity of the enemy.
Definition enemy.h:52
Vec2 direction
Direction the enemy is facing/moving.
Definition enemy.h:53
Vec2 position
Current position of the enemy.
Definition enemy.h:51
Enemy statistics structure.
Definition enemy.h:70
float maxSpeed
Maximum movement speed.
Definition enemy.h:73
int maxHealth
Maximum health points.
Definition enemy.h:72
int damage
Base damage enemy can inflict.
Definition enemy.h:71
int attackCooldown
Time between attacks.
Definition enemy.h:79
int attackRange
Maximum attack range.
Definition enemy.h:77
float acceleration
Movement acceleration rate.
Definition enemy.h:74
int attackSpeed
Speed of attack execution.
Definition enemy.h:76
float drag
Movement deceleration/friction.
Definition enemy.h:75
int attackDamage
Damage inflicted by attacks.
Definition enemy.h:78
Represents a chunk of the environment.
Definition chunks.h:105
A struct that represents the configurations of a particle emitter.
Definition particles.h:105
The Timer struct used to keep track of time.
Definition timer.h:48
A 2D vector structure.
Definition vec2.h:81
Provides timing functionality for cooldowns, fire rates, animations, and other time-based features.
Provides 2D vector functionality for positions, directions, and transformations.