From 918fc112bd8fdf625ac49075c26a066ace06074f Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 25 Jul 2023 17:41:17 -0500 Subject: [PATCH] Rapid fire reimplemented because I goofed? --- Crawler/Player.cpp | 17 +++++++++++++++++ Crawler/Ranger.cpp | 32 -------------------------------- Crawler/Version.h | 2 +- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index e1b76a6a..ee002877 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -419,6 +419,23 @@ void Player::Update(float fElapsedTime){ ghostFrameTimer=RETREAT_GHOST_FRAME_DELAY; } } + if(rapidFireTimer>0){ + rapidFireTimer-=fElapsedTime; + if(rapidFireTimer<=0){ + if(remainingRapidFireShots>0){ + remainingRapidFireShots--; + geom2d::line pointTowardsCursor(GetPos(),game->GetWorldMousePos()); + vf2d extendedLine=pointTowardsCursor.upoint(1.1); + float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); + attack_cooldown_timer=ARROW_ATTACK_COOLDOWN; + BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*250,float(sin(angleToCursor)*250-PI/8*250)}+movementVelocity,12,GetAttack(),OnUpperLevel(),true))); + SetAnimationBasedOnTargetingDirection(angleToCursor); + rapidFireTimer=RAPID_FIRE_SHOOT_DELAY; + }else{ + SetState(State::NORMAL); + } + } + } #pragma endregion } diff --git a/Crawler/Ranger.cpp b/Crawler/Ranger.cpp index dcba37eb..964d8f6a 100644 --- a/Crawler/Ranger.cpp +++ b/Crawler/Ranger.cpp @@ -29,38 +29,6 @@ AnimationState Ranger::walk_w=RANGER_WALK_W; SETUP_CLASS(Ranger) void Ranger::OnUpdate(float fElapsedTime){ - if(GetState()==SHOOT_ARROW){ - if(attack_cooldown_timer<=ARROW_ATTACK_COOLDOWN-0.3){ - SetState(NORMAL); - } - } - if(retreatTimer>0){ - SetZ(6*sin(PI/RETREAT_TIME*retreatTimer)); - retreatTimer-=fElapsedTime; - if(retreatTimer<=0){ - SetVelocity({}); - SetZ(0); - SetState(State::NORMAL); - } - } - if(ghostRemoveTimer>0){ - ghostRemoveTimer-=fElapsedTime; - if(ghostRemoveTimer<=0){ - if(ghostPositions.size()>0){ - ghostPositions.erase(ghostPositions.begin()); - if(ghostPositions.size()>0){ - ghostRemoveTimer=RETREAT_GHOST_FRAME_DELAY; - } - } - } - } - if(ghostFrameTimer>0){ - ghostFrameTimer-=fElapsedTime; - if(ghostFrameTimer<=0&&GetState()==State::RETREAT){ - ghostPositions.push_back(GetPos()+vf2d{0,-GetZ()}); - ghostFrameTimer=RETREAT_GHOST_FRAME_DELAY; - } - } } bool Ranger::AutoAttack(){ diff --git a/Crawler/Version.h b/Crawler/Version.h index d1224191..943ace7d 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 833 +#define VERSION_BUILD 836 #define stringify(a) stringify_(a) #define stringify_(a) #a