LI2 Roguelite
Functions
player.c File Reference
#include <stdlib.h>
#include <ncurses.h>
#include "player.h"
#include "item.h"
#include "inventory.h"
Include dependency graph for player.c:

Functions

PlayerinitPlayer (int x, int y)
 Initializes a new player. Allocates memory for a new player and initializes its fields. More...
 
void drawPlayer (Player *p)
 Draws the player on the screen. More...
 
void updatePotionEffects (Player *p)
 Updates the potion effects of the player. More...
 
void freePlayer (void *p)
 frees the player. Sets all fields to 0 and frees the memory. More...
 

Function Documentation

◆ drawPlayer()

void drawPlayer ( Player p)

Draws the player on the screen.

TODO: colors damage the player and add color to player

Parameters
pPlayer to draw
Returns
void

◆ freePlayer()

void freePlayer ( void *  p)

frees the player. Sets all fields to 0 and frees the memory.

Parameters
pPlayer to free
Returns
void

◆ initPlayer()

Player* initPlayer ( int  x,
int  y 
)

Initializes a new player. Allocates memory for a new player and initializes its fields.

Parameters
xPlayer x initial coordinate
yPlayer y initial coordinate
Returns
Player* Initialized player at (x,y)

◆ updatePotionEffects()

void updatePotionEffects ( Player p)

Updates the potion effects of the player.

Sensory potion: increases the player vision and earing Invincibility potion: increases the player defense

Parameters
pPlayer to update
Returns
void