From 78f847a25d37819515468fb39e214d354f889c70 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Tue, 4 Jan 2022 23:08:13 +0100 Subject: shotty makes a sound --- src/weapon.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/weapon.cpp') diff --git a/src/weapon.cpp b/src/weapon.cpp index c876481..a774676 100644 --- a/src/weapon.cpp +++ b/src/weapon.cpp @@ -8,8 +8,19 @@ #include "weapon.hpp" -Weapon::Weapon(float const & rg, unsigned int const & dmg) : +Weapon::Weapon(float const & rg, unsigned int const & dmg, const char *s, const char *r) : range(rg), damage(dmg) -{} +{ + InitAudioDevice(); + shot = LoadSound(s); + reload = LoadSound(r); + SetSoundVolume(shot, 0.3f); + SetSoundVolume(reload, 0.3f); +} Weapon::~Weapon() {} + +void Weapon::bang() const +{ + PlaySound(shot); +} -- cgit v1.2.3