aboutsummaryrefslogtreecommitdiffstats
path: root/src/wp_assaultrifle.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-11 17:04:34 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-11 17:04:34 +0100
commit0f52cc0373370d639b8de42c7c9551da0db86d52 (patch)
tree35c270760a1d9b3b1c11e3a3b55268aac464d1ea /src/wp_assaultrifle.cpp
parentmouselook on shotgun (diff)
downloadthreshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.gz
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.bz2
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.xz
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.tar.zst
threshold-0f52cc0373370d639b8de42c7c9551da0db86d52.zip
clang-format chromium test
Diffstat (limited to 'src/wp_assaultrifle.cpp')
-rw-r--r--src/wp_assaultrifle.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/wp_assaultrifle.cpp b/src/wp_assaultrifle.cpp
index 1ed9e19..2d4ab0f 100644
--- a/src/wp_assaultrifle.cpp
+++ b/src/wp_assaultrifle.cpp
@@ -7,7 +7,7 @@
#include "entity.hpp"
wp_assaultrifle::wp_assaultrifle(const char *s, const char *r)
- : AWeapon(100, 10, 30, 0.0, s, r)
+ : AWeapon(300.0f, 10, 30, 0.0, s, r)
{}
@@ -18,22 +18,25 @@ int wp_assaultrifle::bang(std::vector<Entity> * enemies, Entity * player)
{
return (1);
} else {
+ 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();
// here
//
- Vector2 playerDirection = player->direction;
- Vector2 playerPosition = (Vector2){player->posX, player->posY};
- 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;
- r.x *= 4;
- r.y *= 4;
-
+ r = playerDirection;
+ r.x *= 2;
+ r.y *= 2;
for (auto en = enemies->begin(); en != enemies->end(); en++)
{
if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, add1, (en->radius * 2)) ||