aboutsummaryrefslogtreecommitdiffstats
path: root/src/wp_shotty.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-07 00:33:33 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-07 00:33:44 +0100
commit43852f3019c02645e625946fe8c237070eef6a2f (patch)
treee78b3423e6cda8e8d9dd3a5ef23e15184571978e /src/wp_shotty.cpp
parentalmost there (diff)
downloadthreshold-43852f3019c02645e625946fe8c237070eef6a2f.tar.gz
threshold-43852f3019c02645e625946fe8c237070eef6a2f.tar.bz2
threshold-43852f3019c02645e625946fe8c237070eef6a2f.tar.xz
threshold-43852f3019c02645e625946fe8c237070eef6a2f.tar.zst
threshold-43852f3019c02645e625946fe8c237070eef6a2f.zip
weapons ready to be implemented. release v0.0.5
Diffstat (limited to '')
-rw-r--r--src/wp_shotty.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/wp_shotty.cpp b/src/wp_shotty.cpp
index a0d5de4..4efb64e 100644
--- a/src/wp_shotty.cpp
+++ b/src/wp_shotty.cpp
@@ -12,7 +12,7 @@ wp_shotty::wp_shotty(float const &rg, unsigned int const &dmg, unsigned int cons
-int wp_shotty::bang(std::vector<Entity> * enemies, Vector2 playerDirection, Vector2 playerPosition)
+int wp_shotty::bang(std::vector<Entity> * enemies, Vector2 playerDirection, Vector2 playerPosition, int * victims)
{
if (barrel == 0)
{
@@ -33,14 +33,8 @@ int wp_shotty::bang(std::vector<Entity> * enemies, Vector2 playerDirection, Vect
r.x *= 2;
r.y *= 2;
- std::cout << "before loop";
- if (enemies == NULL)
- {
- return (0);
- }
for (auto en = enemies->begin(); en != enemies->end(); en++)
{
- std::cout << "loop";
if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, add1, (en->radius * 2)) ||
CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, Vector2Add(playerPosition, r), (en->radius * 2)) ||
CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, add2, (en->radius * 2)))
@@ -50,8 +44,8 @@ int wp_shotty::bang(std::vector<Entity> * enemies, Vector2 playerDirection, Vect
{
en->direction.x = (playerDirection.x / 2);
en->direction.y = (playerDirection.y / 2);
- // player->victims++;
}
+ *victims += 1;
}
}
// shotty cone
@@ -67,7 +61,6 @@ int wp_shotty::bang(std::vector<Entity> * enemies, Vector2 playerDirection, Vect
if (barrel == 0)
{
empty = true;
- return (1);
}
return (0);
}