using specific SFX for projectiles

a new SFX for torpedos
This commit is contained in:
devZoGok
2024-01-26 15:12:14 +02:00
parent c8523351fa
commit 213536db2f
5 changed files with 4 additions and 7 deletions
@@ -7,7 +7,7 @@ projectiles = {
size = {x = 1.2, y = 2.7, z = .54},
speed = .5,
rotAngle = .1,
explosion = {damage = 100, radius = 20},
explosion = {damage = 100, radius = 20, sfx = PATH .. 'Sounds/SFX/Explosions/explosion02.ogg'},
directHitDamage = 450,
rayLength = 1.25,
name = "Cruise missile",
@@ -18,7 +18,7 @@ projectiles = {
projectileClass = ProjectileClass.TORPEDO,
size = {x = .2, y = 1.6, z = .2},
speed = .06,
explosion = {damage = 20, radius = 3},
explosion = {damage = 20, radius = 3, sfx = PATH .. 'Sounds/Units/Submarines/torpedo.ogg'},
directHitDamage = 450,
rayLength = .75,
name = "Torpedo",
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -5
View File
@@ -64,12 +64,9 @@ namespace battleship{
}
void Projectile::initSound(){
GameManager *gm = GameManager::getSingleton();
explosionSfxBuffer = new sf::SoundBuffer();
string p2 = gm->getPath() + "Sounds/SFX/Explosions/explosion0" + to_string(rand() % 4) + ".ogg";
if(explosionSfxBuffer->loadFromFile(p2.c_str()))
explosionSfx = new sf::Sound(*explosionSfxBuffer);
string sfxPath = generateView()[GameObject::getGameObjTableName()][id + 1]["explosion"]["sfx"];
explosionSfx = GameObject::prepareSfx(explosionSfxBuffer, sfxPath);
}
void Projectile::update() {