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

Implements update logic for Sentry enemy type. More...

#include <enemy_sentry.h>
#include <player.h>
#include <time_system.h>
#include <random.h>
#include <circle.h>
#include <math.h>

Functions

void Sentry_UpdateGun (EnemyData *data)
 Updates the gun position and orientation for the Sentry enemy.
 
void Sentry_UpdateLazer (EnemyData *data)
 Updates the laser targeting system for the Sentry enemy.
 
void Sentry_Update (EnemyData *data)
 [PostUpdate] Updates the Sentry enemy's state and behavior
 
void Sentry_UpdateParticles ()
 Updates all particle emitters related to the Sentry enemy.
 

Detailed Description

Implements update logic for Sentry enemy type.

Contains the AI behavior and state updates for the Sentry enemy.

Author
Mango
Date
2025-03-22

Function Documentation

◆ Sentry_Update()

void Sentry_Update ( EnemyData *  data)

[PostUpdate] Updates the Sentry enemy's state and behavior

Handles the state machine for the Sentry enemy, including idle, aiming, and shooting states. The Sentry enemy uses a laser-based weapon that sweeps across an area after targeting.

Parameters
dataPointer to the enemy data structure

◆ Sentry_UpdateGun()

void Sentry_UpdateGun ( EnemyData *  data)

Updates the gun position and orientation for the Sentry enemy.

Calculates the gun position, rotation, and orientation based on the enemy's position and the player's location. Also updates associated particle emitters for muzzle flash and bullet casings.

Parameters
dataPointer to the enemy data structure

◆ Sentry_UpdateLazer()

void Sentry_UpdateLazer ( EnemyData *  data)

Updates the laser targeting system for the Sentry enemy.

Calculates the laser beam's path from the gun to the first obstacle or player, performing collision detection and damage application when in shooting state. The laser acts as both a visual cue and combat mechanic.

Parameters
dataPointer to the enemy data structure

◆ Sentry_UpdateParticles()

void Sentry_UpdateParticles ( )

Updates all particle emitters related to the Sentry enemy.

Processes particle physics, collision detection, and damage calculation for bullets fired by the Sentry enemy. Also handles visual effects such as muzzle flash, bullet casings, and bullet impact fragments.