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

Implements player combat functionality. More...

#include <player.h>
#include <sound.h>
#include <random.h>
#include <interactable.h>
#include <interactable_crate.h>

Functions

void Player_Shoot ()
 [Utility] Makes the player shoot their current weapon
 
void Player_SwitchGun ()
 [Utility] Changes the player's active weapon
 
void Player_PickUpGun (void *data, int interactableIndex)
 Picks up a gun.
 
void Player_PickUpHealth (void *data, int interactableIndex)
 
void Player_PickUpSkill (void *data, int interactableIndex)
 
void Player_OpenCrate (void *data, int interactableIndex)
 Opens a crate This function is a callback when the player interacts with a closed crate.
 
void Player_ReadLog (void *data, int interactableIndex)
 
void Player_TakeDamage (int damage)
 
void Player_RenderDamageEffect ()
 

Variables

float damageEffectOpacity = 0
 

Detailed Description

Implements player combat functionality.

Handles player attacks, weapon use, and combat interactions with enemies and the environment.

Author
Mango
Date
2025-03-04

Function Documentation

◆ Player_OpenCrate()

void Player_OpenCrate ( void *  data,
int  interactableIndex 
)

Opens a crate This function is a callback when the player interacts with a closed crate.

Parameters
dataThe gun data
interactableIndexThe index of the interactable crate.

◆ Player_PickUpGun()

void Player_PickUpGun ( void *  data,
int  interactableIndex 
)

Picks up a gun.

This function is a callback when the player interacts with a gun on the ground.

Parameters
dataThe gun data
interactableIndexThe index of the interactable gun on the ground.
Todo:
[player_combat.c:77] Add gun pickup sfx

◆ Player_PickUpHealth()

void Player_PickUpHealth ( void *  data,
int  interactableIndex 
)

◆ Player_PickUpSkill()

void Player_PickUpSkill ( void *  data,
int  interactableIndex 
)

◆ Player_ReadLog()

void Player_ReadLog ( void *  data,
int  interactableIndex 
)

◆ Player_RenderDamageEffect()

void Player_RenderDamageEffect ( )

◆ Player_Shoot()

void Player_Shoot ( )

[Utility] Makes the player shoot their current weapon

Makes player shoot current weapon.

Activates the shooting sequence, including sound effects, particle effects for muzzle flash and casings, and creating bullet projectiles.

◆ Player_SwitchGun()

void Player_SwitchGun ( )

[Utility] Changes the player's active weapon

Changes player's current weapon.

◆ Player_TakeDamage()

void Player_TakeDamage ( int  damage)

Variable Documentation

◆ damageEffectOpacity

float damageEffectOpacity = 0