player health
This commit is contained in:
@@ -73,6 +73,7 @@ void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
|
||||
if(AABB_Slab(bandit->collision.pos, banditShot, world->player.collision)){
|
||||
// gets shot lmao
|
||||
printf("hit");
|
||||
world->player.health--;
|
||||
}
|
||||
if(bandit->bullets == 0){
|
||||
printf("enemy reload");
|
||||
|
||||
@@ -53,6 +53,10 @@ void PlayerInput(SDL_Event *event, Player *player)
|
||||
void PlayerUpdate(F32 delta, Player *player) {
|
||||
player->controls.shot = false;
|
||||
V2f dir = V2F(0, 0);
|
||||
if(player->health == 0){
|
||||
printf("dead :(");
|
||||
player->health = 3;
|
||||
}
|
||||
if(player->controls.upDown) {
|
||||
dir.y -= 1;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ struct Player
|
||||
U32 bulletsLoaded;
|
||||
ControlState controls;
|
||||
V2f shotPos;
|
||||
|
||||
U32 health;
|
||||
F32 reloadTimer;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user