Multishot Ranger ability implemented.
This commit is contained in:
+16
-3
@@ -70,18 +70,31 @@ void Ranger::InitializeClassAbilities(){
|
||||
return true;
|
||||
};
|
||||
#pragma endregion
|
||||
#pragma region Ranger Ability 2 (???)
|
||||
#pragma region Ranger Ability 2 (Charged Shot)
|
||||
Ranger::ability2.action=
|
||||
[](Player*p,vf2d pos={}){
|
||||
vf2d arrowVelocity=util::pointTo(p->GetPos(),game->GetWorldMousePos());
|
||||
BULLET_LIST.push_back(std::make_unique<ChargedArrow>(p->GetPos(),arrowVelocity*600,20,p->GetAttack()*2.5,p->OnUpperLevel(),true));
|
||||
p->SetAnimationBasedOnTargetingDirection(atan2(arrowVelocity.y,arrowVelocity.x));
|
||||
return true;
|
||||
};
|
||||
#pragma endregion
|
||||
#pragma region Ranger Ability 3 (???)
|
||||
#pragma region Ranger Ability 3 (Multi Shot)
|
||||
Ranger::ability3.action=
|
||||
[](Player*p,vf2d pos={}){
|
||||
return false;
|
||||
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),game->GetWorldMousePos());
|
||||
float shootingDist=pointTowardsCursor.length();
|
||||
vf2d shootingDirMiddle=pointTowardsCursor.vector();
|
||||
float shootingAngle=atan2(shootingDirMiddle.y,shootingDirMiddle.x);
|
||||
for(int i=0;i<7;i++){
|
||||
if(i==3)continue;
|
||||
float newAngle=shootingAngle-3.f/16*PI+i*1.f/16*PI;
|
||||
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
|
||||
vf2d extendedLine=pointTowardsCursor.upoint(1.1);
|
||||
BULLET_LIST.push_back(std::make_unique<Arrow>(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*250,float(sin(newAngle)*250-PI/8*250)}+p->movementVelocity,12,p->GetAttack(),p->OnUpperLevel(),true)));
|
||||
}
|
||||
p->SetAnimationBasedOnTargetingDirection(shootingAngle);
|
||||
return true;
|
||||
};
|
||||
#pragma endregion
|
||||
}
|
||||
Reference in New Issue
Block a user