aboutsummaryrefslogtreecommitdiffstats
path: root/src/weapon.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-05 21:42:26 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-05 21:42:26 +0100
commit4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca (patch)
treed35d35c340e63589350c351738d4af3dab68e3d8 /src/weapon.cpp
parentterrain is fukkkkd (diff)
downloadthreshold-4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca.tar.gz
threshold-4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca.tar.bz2
threshold-4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca.tar.xz
threshold-4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca.tar.zst
threshold-4e266c0e8f0b49cb39f3f2c3bc43d0bc09cc3aca.zip
reload works
Diffstat (limited to '')
-rw-r--r--src/weapon.cpp10
1 files changed, 7 insertions, 3 deletions
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 <iostream>
+
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);
}