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.
|
| 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...
|
|
| 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.
|
|
| | 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;}) |
Gestion du joueur : structures Player, Weapon.
◆ INITIAL_PLAYER_LIVES
| #define INITIAL_PLAYER_LIVES 3 |
◆ 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.
◆ PatternType
| Valeurs énumérées |
|---|
| DEFAULT_PATTERN | |
◆ PlayerName
Identifiants de personnages jouables.
| Valeurs énumérées |
|---|
| TEST_PLAYER | |
◆ Damage_player()
Inflige des dégâts au joueur et gère les conséquences (respawn, invincibilité, effets sonores... ).
- Paramètres
-
| ctx | GameContext courant (toutes les données du jeu) |
| player | joueur à 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() [2/7]
◆ 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()
◆ Player_get_playerID()
Récupère l'id du joueur. Il n'y a toujours qu'un seul joueur actif, on peut donc l'identifier.
- Paramètres
-
| p | pool 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
-
| p | pool 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
-
| p | pool courante (toutes les données de l'ECS) |
- Renvoie
- coordonée Y du joueur
◆ Player_start()
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
-
| ctx | Contexte de jeu |
| name | Type de joueur à instancier. |
| type | Type de pattern d'arme à utiliser. |
◆ Player_update()
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
-
◆ 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
-
| p | pool courante (toutes les données de l'ECS) |
| e | Entité à téléporter. |