Added audio playback

Playing music
This commit is contained in:
2025-10-06 21:54:48 +01:00
parent 87d3c9087e
commit 59f643b72c
7 changed files with 201 additions and 32 deletions

View File

@@ -13,12 +13,10 @@ void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
if (
world->player.controls.shot && AABB_Slab(world->player.collision.pos, world->player.shotPos, bandit->collision) && bandit->currentArea == world->player.currentArea)
{
printf("You shot the bandit %*.s\n", Sv(bandit->name));
bandit->health--;
}
if (AABB_Circle(bandit->agroRadius, AABB_Centre(bandit->collision), world->player.collision) && !(bandit->mode == BANDIT_SHOOTING || bandit->mode == BANDIT_SHOOTOUT))
{
printf("begin shootout");
// shootout time o.o
bandit->mode = BANDIT_SHOOTOUT;
}
@@ -56,7 +54,7 @@ void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
bandit->collision.pos.y = cNav.pos.y * (1 - bandit->walkTimer/NPC_SPEED) + tNav.pos.y * bandit->walkTimer/NPC_SPEED;
break;
case BANDIT_SHOOTOUT:
bandit->shootoutTimer-=delta;
bandit->shootoutTimer-=delta;
if(bandit->shootoutTimer < 0){
bandit->mode=BANDIT_SHOOTING;
}
@@ -66,17 +64,14 @@ void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
bandit->reloadTimer -= delta;
if (bandit->shootCooldownTimer < 0 && bandit->reloadTimer < 0)
{
printf("shoot at player");
bandit->bullets--;
bandit->shootCooldownTimer = bandit->shootDelay;
V2f banditShot = shootTowards(bandit, world->player.collision.pos, &world->random);
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");
bandit->bullets = 6;
bandit->reloadTimer = bandit->reloadTime;
}

View File

@@ -128,7 +128,6 @@ 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) {