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 /src/wp_shotty.cpp | |
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
Diffstat (limited to '')
-rw-r--r-- | src/wp_shotty.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
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; |