aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameplay.cpp
diff options
context:
space:
mode:
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)) ||