Add a cutoff height to player system

This commit is contained in:
Edgaru089 2024-04-14 14:34:01 +08:00
parent 4eddb8993d
commit 381886fe96
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,7 @@ System_Player *player_NewSystem(App *super) {
System_Player *sys = malloc(sizeof(System_Player));
sys->super = super;
sys->player = NULL;
sys->cutoff = 5000.0;
return sys;
}
void player_DeleteSystem(System_Player *sys) {
@ -152,7 +153,7 @@ void player_Advance(System_Player *sys, Duration deltaTime) {
// Respawn if fallen out of the world
if (p->super->position->position.y > 5000)
if (p->super->position->position.y > sys->cutoff)
player_HazardHarm(sys);

View File

@ -39,6 +39,10 @@ typedef struct {
// The player in the world.
// Control is paused if equals NULL.
Component_Player *player;
// Cutoff Y position.
// If the player is lower than this position, the player is environment harmed.
double cutoff;
} System_Player;
System_Player *player_NewSystem(App *super);