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