diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-04 23:08:13 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-04 23:08:13 +0100 |
commit | 78f847a25d37819515468fb39e214d354f889c70 (patch) | |
tree | 2aa5d204f2460b38e6362a4e4b0c58b0fd5aa96d /src/gameplay.cpp | |
parent | two levels. moved shooting logic elsewhere (diff) | |
download | threshold-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.cpp | 7 |
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)) || |