Yume Project 3.0
Touhou-inspired Danmaku game made in C only
Chargement...
Recherche...
Aucune correspondance
Référence du fichier player.h

Gestion du joueur : structures Player, Weapon. Plus de détails...

#include "component.h"
#include "common.h"
#include "tasks.h"

Aller au code source de ce fichier.

Classes

struct  Player
 Composante Player dans l'ECS Représente l'état et les attributs d'un joueur. Le joueur est la seule entité a utiliser cette composante. Plus de détails...
struct  Weapon
 Composante weapon dans l'ECS Contient les informations d'une arme du joueur. Le joueur est la seule entité a utiliser cette composante. Plus de détails...

Macros

#define INITIAL_PLAYER_LIVES   3

Définitions de type

typedef struct Player Player
 Composante Player dans l'ECS Représente l'état et les attributs d'un joueur. Le joueur est la seule entité a utiliser cette composante.
typedef struct Weapon Weapon
 Composante weapon dans l'ECS Contient les informations d'une arme du joueur. Le joueur est la seule entité a utiliser cette composante.

Énumérations

enum  PlayerName { TEST_PLAYER }
 Identifiants de personnages jouables. Plus de détails...
enum  PatternType { DEFAULT_PATTERN }

Fonctions

 DEFINE_COMPONENT_MANAGER (Player, 1)
 DEFINE_COMPONENT_MANAGER (Weapon, 1)
 DECLARE_SETTER_GETTER (Player, int, nbBombs)
 DECLARE_SETTER_GETTER (Player, int, bombs)
 DECLARE_SETTER_GETTER (Player, float, speed)
 DECLARE_SETTER_GETTER (Player, float, focusSpeed)
 DECLARE_SETTER_GETTER (Player, Entity, hitboxSpriteId)
 DECLARE_SETTER_GETTER (Player, Entity, GrazeSpriteId)
 DECLARE_SETTER_GETTER (Player, int, grazeRadius)
void Player_start (GameContext *ctx, PlayerName name, PatternType type)
 Initialise et crée l'entité joueur dans la pool.
void Player_update (GameContext *ctx)
 Mise à jour par frame du joueur (input, tir, focus, graze, dégâts...).
Entity Player_get_playerID (Pool *p)
 Récupère l'id du joueur. Il n'y a toujours qu'un seul joueur actif, on peut donc l'identifier.
float Player_GetX (Pool *p)
 Récupère la position X du joueur.
float Player_GetY (Pool *p)
 Récupère la position Y du joueur.
void teleport_to_player_spawn (Pool *p, Entity e)
 Téléporte une entité vers le point de spawn du joueur.
bool Damage_player (GameContext *ctx, Entity player)
 Inflige des dégâts au joueur et gère les conséquences (respawn, invincibilité, effets sonores... ).
void Player_bomb (GameContext *ctx, Entity player)
 DECLARE_EXTERN_TASK (reimu_yinyang_orb, {GameContext *ctx;Entity player;float angle_offset;})

Description détaillée

Gestion du joueur : structures Player, Weapon.

Documentation des macros

◆ INITIAL_PLAYER_LIVES

#define INITIAL_PLAYER_LIVES   3

Documentation des définitions de type

◆ Player

typedef struct Player Player

Composante Player dans l'ECS Représente l'état et les attributs d'un joueur. Le joueur est la seule entité a utiliser cette composante.

◆ Weapon

typedef struct Weapon Weapon

Composante weapon dans l'ECS Contient les informations d'une arme du joueur. Le joueur est la seule entité a utiliser cette composante.

Documentation du type de l'énumération

◆ PatternType

Valeurs énumérées
DEFAULT_PATTERN 

◆ PlayerName

enum PlayerName

Identifiants de personnages jouables.

Valeurs énumérées
TEST_PLAYER 

Documentation des fonctions

◆ Damage_player()

bool Damage_player ( GameContext * ctx,
Entity player )
extern

Inflige des dégâts au joueur et gère les conséquences (respawn, invincibilité, effets sonores... ).

Paramètres
ctxGameContext courant (toutes les données du jeu)
playerjoueur à blesser
Renvoie
true si l'opération a été effectuée sans erreur, false sinon.

◆ DECLARE_EXTERN_TASK()

DECLARE_EXTERN_TASK ( reimu_yinyang_orb ,
{GameContext *ctx;Entity player;float angle_offset;}  )

◆ DECLARE_SETTER_GETTER() [1/7]

DECLARE_SETTER_GETTER ( Player ,
Entity ,
GrazeSpriteId  )

◆ DECLARE_SETTER_GETTER() [2/7]

DECLARE_SETTER_GETTER ( Player ,
Entity ,
hitboxSpriteId  )

◆ DECLARE_SETTER_GETTER() [3/7]

DECLARE_SETTER_GETTER ( Player ,
float ,
focusSpeed  )

◆ DECLARE_SETTER_GETTER() [4/7]

DECLARE_SETTER_GETTER ( Player ,
float ,
speed  )

◆ DECLARE_SETTER_GETTER() [5/7]

DECLARE_SETTER_GETTER ( Player ,
int ,
bombs  )

◆ DECLARE_SETTER_GETTER() [6/7]

DECLARE_SETTER_GETTER ( Player ,
int ,
grazeRadius  )

◆ DECLARE_SETTER_GETTER() [7/7]

DECLARE_SETTER_GETTER ( Player ,
int ,
nbBombs  )

◆ DEFINE_COMPONENT_MANAGER() [1/2]

DEFINE_COMPONENT_MANAGER ( Player ,
1  )

◆ DEFINE_COMPONENT_MANAGER() [2/2]

DEFINE_COMPONENT_MANAGER ( Weapon ,
1  )

◆ Player_bomb()

void Player_bomb ( GameContext * ctx,
Entity player )
extern

◆ Player_get_playerID()

Entity Player_get_playerID ( Pool * p)
extern

Récupère l'id du joueur. Il n'y a toujours qu'un seul joueur actif, on peut donc l'identifier.

Paramètres
ppool courante (toutes les données de l'ECS)
Renvoie
id du joueur (index 0 du PlayerManager).

◆ Player_GetX()

float Player_GetX ( Pool * p)
extern

Récupère la position X du joueur.

Paramètres
ppool courante (toutes les données de l'ECS)
Renvoie
coordonée X du joueur

◆ Player_GetY()

float Player_GetY ( Pool * p)
extern

Récupère la position Y du joueur.

Paramètres
ppool courante (toutes les données de l'ECS)
Renvoie
coordonée Y du joueur

◆ Player_start()

void Player_start ( GameContext * ctx,
PlayerName name,
PatternType type )
extern

Initialise et crée l'entité joueur dans la pool.

Crée l'entité joueur, initialise ses composants: Player, Weapon, Position, Sprite, Collision_circle, Life, etc.) et place le joueur au point de spawn.

Paramètres
ctxContexte de jeu
nameType de joueur à instancier.
typeType de pattern d'arme à utiliser.

◆ Player_update()

void Player_update ( GameContext * ctx)
extern

Mise à jour par frame du joueur (input, tir, focus, graze, dégâts...).

Appelée depuis la boucle principale pour traiter l'input et les actions du joueur.

Paramètres
ctxGameContext courant (toutes les données du jeu)

◆ teleport_to_player_spawn()

void teleport_to_player_spawn ( Pool * p,
Entity e )
extern

Téléporte une entité vers le point de spawn du joueur.

Utilisé pour repositionner le joueur après qu'il ai subit des dégâts où au début du jeu.

Paramètres
ppool courante (toutes les données de l'ECS)
eEntité à téléporter.