Rapid fire reimplemented because I goofed?

pull/28/head
sigonasr2 2 years ago
parent 745a85aa55
commit 918fc112bd
  1. 17
      Crawler/Player.cpp
  2. 32
      Crawler/Ranger.cpp
  3. 2
      Crawler/Version.h

@ -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>(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
}

@ -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(){

@ -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

Loading…
Cancel
Save