Add a cutoff height to player system
This commit is contained in:
parent
4eddb8993d
commit
381886fe96
3
player.c
3
player.c
@ -21,6 +21,7 @@ System_Player *player_NewSystem(App *super) {
|
|||||||
System_Player *sys = malloc(sizeof(System_Player));
|
System_Player *sys = malloc(sizeof(System_Player));
|
||||||
sys->super = super;
|
sys->super = super;
|
||||||
sys->player = NULL;
|
sys->player = NULL;
|
||||||
|
sys->cutoff = 5000.0;
|
||||||
return sys;
|
return sys;
|
||||||
}
|
}
|
||||||
void player_DeleteSystem(System_Player *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
|
// 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);
|
player_HazardHarm(sys);
|
||||||
|
|
||||||
|
|
||||||
|
4
player.h
4
player.h
@ -39,6 +39,10 @@ typedef struct {
|
|||||||
// The player in the world.
|
// The player in the world.
|
||||||
// Control is paused if equals NULL.
|
// Control is paused if equals NULL.
|
||||||
Component_Player *player;
|
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;
|
||||||
|
|
||||||
System_Player *player_NewSystem(App *super);
|
System_Player *player_NewSystem(App *super);
|
||||||
|
Loading…
Reference in New Issue
Block a user