aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameplay.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-04 23:08:13 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-04 23:08:13 +0100
commit78f847a25d37819515468fb39e214d354f889c70 (patch)
tree2aa5d204f2460b38e6362a4e4b0c58b0fd5aa96d /src/gameplay.cpp
parenttwo levels. moved shooting logic elsewhere (diff)
downloadthreshold-78f847a25d37819515468fb39e214d354f889c70.tar.gz
threshold-78f847a25d37819515468fb39e214d354f889c70.tar.bz2
threshold-78f847a25d37819515468fb39e214d354f889c70.tar.xz
threshold-78f847a25d37819515468fb39e214d354f889c70.tar.zst
threshold-78f847a25d37819515468fb39e214d354f889c70.zip
shotty makes a sound
Diffstat (limited to 'src/gameplay.cpp')
-rw-r--r--src/gameplay.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index 59ef73a..de8dd88 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -11,6 +11,8 @@
#include "raymath.h"
#include <fstream>
+#include "weapon.hpp"
+
Game::Game(std::string const & path)
{
std::ifstream ifs(path);
@@ -47,6 +49,9 @@ Game::Game(std::string const & path)
player->direction.y = 100;
player->radius = 10;
player->victims = 0;
+ player->wp = new Weapon(10, 10,
+ "../meta/media/mp3/shotty_shoot.mp3",
+ "../meta/media/mp3/shotty_reload.mp3");
}
Game::~Game()
@@ -167,6 +172,8 @@ Game::shoot() const
auto add1 = Vector2Add((Vector2){player->posX, player->posY}, rot1);
auto add2 = Vector2Add((Vector2){player->posX, player->posY}, rot2);
+
+ player->wp->bang();
for (auto en = enemies->begin(); en != enemies->end(); en++)
{
if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, (Vector2){player->posX, player->posY}, add1, (en->radius * 2)) ||