Skip to content

Commit

Permalink
More 3d sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvaka committed Mar 14, 2024
1 parent d56543e commit deda1c6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Bat::~Bat()
}

void Bat::Screech() const {
Assets::batScreech.Play(pos, Player::instance()->pos, Window::GAME_WIDTH*0.6);
Assets::batScreech.Play(pos, Player::instance()->pos, Window::GAME_WIDTH*0.6f);
}

void Bat::Update(float dt)
Expand Down
6 changes: 4 additions & 2 deletions src/common_bullet.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "assets_sounds.h"
#include "gaemtilemap.h"
#include "destroyedtiles.h"
#include "window_conf.h"
#include "player.h"

// Takes the bullet radius into account to calculate collisions,
// use SmallBulletTilemapCollision for single-pixel collisions
Expand All @@ -27,7 +29,7 @@ bool BigBulletTilemapCollision(T* bullet, Tile::BreakResistance breakTilesPower
return false;
hit:
if (tile.isBreakable(breakTilesPower)) {
Assets::breakBlock.Play();
Assets::breakBlock.Play(bullet->pos, Player::instance()->pos, Window::GAME_WIDTH);
DestroyedTiles::instance()->Destroy(t.x, t.y);
}
return true;
Expand All @@ -49,7 +51,7 @@ bool SmallBulletTilemapCollision(T* bullet, Tile::BreakResistance breakTilesPowe
return false;
hit:
if (tile.isBreakable(breakTilesPower)) {
Assets::breakBlock.Play();
Assets::breakBlock.Play(bullet->pos, Player::instance()->pos, Window::GAME_WIDTH);
DestroyedTiles::instance()->Destroy(t.x, t.y);
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/fireslime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void FireSlime::Update(float dt)

if (ReceiveDamageFromPlayer(Bounds(), false)) {
DieWithSmallExplosion(this); //single hit
Assets::soundSlimyDead.Play();
Assets::soundSlimyDead.Play(pos, Player::instance()->pos);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/missile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Missile::Missile(vec position, float angleDegs)
, anim(AnimLib::MISSILE)
{
vel = vec::FromAngleDegs(angleDegs, kSpeed);
soundChannel = Assets::soundMissile.Play();
soundChannel = Assets::soundMissile.Play(position, Player::instance()->pos, Window::GAME_WIDTH);
}

void Missile::Update(float dt)
Expand Down

0 comments on commit deda1c6

Please sign in to comment.