diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-11 16:46:23 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-11 16:46:23 +0100 |
commit | 05c565ec70ad24d85b0eaee8f932374c0b5fc813 (patch) | |
tree | 1e2a8fe4bd09beefcc00280b381bf35e6d71db91 | |
parent | mouselook just needed some sleep ! cool (diff) | |
download | threshold-05c565ec70ad24d85b0eaee8f932374c0b5fc813.tar.gz threshold-05c565ec70ad24d85b0eaee8f932374c0b5fc813.tar.bz2 threshold-05c565ec70ad24d85b0eaee8f932374c0b5fc813.tar.xz threshold-05c565ec70ad24d85b0eaee8f932374c0b5fc813.tar.zst threshold-05c565ec70ad24d85b0eaee8f932374c0b5fc813.zip |
mouselook on shotgun
-rw-r--r-- | meta/maps/stage_1_1.bfm | 1 | ||||
-rw-r--r-- | meta/maps/stage_1_start.bfm | 2 | ||||
-rw-r--r-- | src/gameplay.cpp | 2 | ||||
-rw-r--r-- | src/weapon.cpp | 2 | ||||
-rw-r--r-- | src/weapon.hpp | 4 | ||||
-rw-r--r-- | src/wp_shotty.cpp | 23 |
6 files changed, 19 insertions, 15 deletions
diff --git a/meta/maps/stage_1_1.bfm b/meta/maps/stage_1_1.bfm index 8d699ec..93c4385 100644 --- a/meta/maps/stage_1_1.bfm +++ b/meta/maps/stage_1_1.bfm @@ -1,3 +1,4 @@ BOSS 0 0 ENEMIES 15 20 +WAVES 1 15 NEXT stage_1_boss.bfm diff --git a/meta/maps/stage_1_start.bfm b/meta/maps/stage_1_start.bfm index 601bc8f..c243e84 100644 --- a/meta/maps/stage_1_start.bfm +++ b/meta/maps/stage_1_start.bfm @@ -1,4 +1,4 @@ BOSS 0 0 ENEMIES 20 20 -WAVES 2 10 +WAVES 1 20 NEXT stage_1_1.bfm diff --git a/src/gameplay.cpp b/src/gameplay.cpp index d846373..3a3d09b 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -222,7 +222,7 @@ int Game::tick() const if (en->hp != 0 && // check for player death (one shot one kill) CheckCollisionCircles((Vector2){player->posX, player->posY}, 10, (Vector2){en->posX, en->posY}, 40)) { - return (1); + std::cout << "cool" << std::endl; } } return (0); diff --git a/src/weapon.cpp b/src/weapon.cpp index 34f7a12..b52d830 100644 --- a/src/weapon.cpp +++ b/src/weapon.cpp @@ -10,7 +10,7 @@ #include <iostream> -AWeapon::AWeapon(float const & rg, +AWeapon::AWeapon(float const rg, unsigned int const & dmg, unsigned int const & mag, double const & cd, diff --git a/src/weapon.hpp b/src/weapon.hpp index 447cfe5..b6e8c99 100644 --- a/src/weapon.hpp +++ b/src/weapon.hpp @@ -26,11 +26,11 @@ protected: double t; - float const ⦥ + float const range; unsigned int const &damage; public: - AWeapon(float const &rg, + AWeapon(float const rg, unsigned int const &dmg, unsigned int const & mag, double const & cooldown, diff --git a/src/wp_shotty.cpp b/src/wp_shotty.cpp index c84e516..1b5573a 100644 --- a/src/wp_shotty.cpp +++ b/src/wp_shotty.cpp @@ -7,7 +7,7 @@ #include "entity.hpp" wp_shotty::wp_shotty(const char *s, const char *r) - : AWeapon(10, 10, 10, 0.5, s, r) + : AWeapon(100.0f, 10, 10, 0.5, s, r) {} @@ -19,21 +19,24 @@ int wp_shotty::bang(std::vector<Entity> * enemies, Entity * player) { return (1); } else { - Vector2 playerDirection = player->direction; + Vector2 playerDirection = Vector2Normalize(player->direction); + playerDirection.x *= range; + playerDirection.y *= range; Vector2 playerPosition = (Vector2){player->posX, player->posY}; + Vector2 rot1 = Vector2Rotate(playerDirection, -0.2f); + Vector2 rot2 = Vector2Rotate(playerDirection, 0.2f); + + Vector2 add1 = Vector2Add(playerPosition, rot1); + Vector2 add2 = Vector2Add(playerPosition, rot2); + + Vector2 r; barrel--; PlaySound(shot); t = GetTime(); - std::cout << "current time : " << t << "supposed time before next shot : " << (t + cooldown) << std::endl; // here // - auto rot1 = Vector2Rotate(playerDirection, -0.2f); - auto rot2 = Vector2Rotate(playerDirection, 0.2f); - - auto add1 = Vector2Add(playerPosition, rot1); - auto add2 = Vector2Add(playerPosition, rot2); - - auto r = playerDirection; + std::cout << "range : " << range << std::endl; + r = playerDirection; r.x *= 2; r.y *= 2; |