Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
enemy_takedamage.c File Reference

Handles enemy damage and health. More...

#include <enemy.h>
#include <player.h>
#include <stdio.h>

Functions

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 ()
 

Variables

UIElement * EnemyHealthTexts [ENEMY_MAX *10] = {NULL}
 

Detailed Description

Handles enemy damage and health.

Implements the damage processing system for enemies, including health reduction and death checks.

Author
Mango
Date
2025-03-04

Function Documentation

◆ Enemy_CreateHealthText()

void Enemy_CreateHealthText ( Vec2  position,
int  damage 
)

◆ Enemy_RenderHealthTexts()

void Enemy_RenderHealthTexts ( )

◆ Enemy_TakeDamage()

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.

Parameters
enemyPointer to the enemy to damage
damageAmount of damage to apply

◆ Enemy_UpdateHealthTexts()

void Enemy_UpdateHealthTexts ( )

Variable Documentation

◆ EnemyHealthTexts

UIElement* EnemyHealthTexts[ENEMY_MAX *10] = {NULL}