From 4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Wed, 5 Jan 2022 21:42:26 +0100 Subject: reload works --- src/weapon.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/weapon.cpp') diff --git a/src/weapon.cpp b/src/weapon.cpp index 3f5dcec..507c5b3 100644 --- a/src/weapon.cpp +++ b/src/weapon.cpp @@ -8,6 +8,8 @@ #include "weapon.hpp" +#include + Weapon::Weapon(float const & rg, unsigned int const & dmg, const char *s, const char *r) : range(rg), damage(dmg) { @@ -16,24 +18,26 @@ Weapon::Weapon(float const & rg, unsigned int const & dmg, const char *s, const reload = LoadSound(r); SetSoundVolume(shot, 0.3f); SetSoundVolume(reload, 0.3f); - max = barrel = 200; + max = barrel = 5; } Weapon::~Weapon() {} void Weapon::refill() { - auto time = GetTime(); + std::cout << "reload" << std::endl; + PlaySound(reload); + barrel = max; } int Weapon::bang() { if (barrel == 0) { - refill(); return (1); } else { barrel--; + std::cout << "BANG : " << barrel << "shots left" << std::endl; PlaySound(shot); return (0); } -- cgit v1.2.3