Story I unlocks from the beginning of the game.
Warrior auto-attack facing direction is now based on attacking direction of target.
This commit is contained in:
parent
94f314a7aa
commit
8b7703f457
@ -2008,6 +2008,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
LoadingScreen::Reset();
|
||||
previousLevel=currentLevel;
|
||||
currentLevel=map;
|
||||
loadingWaitTime=0.f;
|
||||
|
||||
#pragma region Reset all data (Loading phase 1)
|
||||
LoadingScreen::AddPhase([&](){
|
||||
if(game->MAP_DATA.count(GetCurrentLevel())==0)ERR(std::format("WARNING! Could not load map {}! Does not exist! Refer to levels.txt for valid maps.",map));
|
||||
|
@ -943,19 +943,42 @@ void Player::SetVelocity(vf2d vel){
|
||||
}
|
||||
|
||||
void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){
|
||||
if(GetClass()==Class::RANGER){
|
||||
if(targetDirection<=PI/4&&targetDirection>-PI/4){
|
||||
UpdateAnimation("RANGER_SHOOT_E");
|
||||
} else
|
||||
if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){
|
||||
UpdateAnimation("RANGER_SHOOT_W");
|
||||
} else
|
||||
if(targetDirection<=3*PI/4&&targetDirection>PI/4){
|
||||
UpdateAnimation("RANGER_SHOOT_S");
|
||||
} else
|
||||
if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){
|
||||
UpdateAnimation("RANGER_SHOOT_N");
|
||||
auto FacingEast=[&](){return targetDirection<=PI/4&&targetDirection>-PI/4;};
|
||||
auto FacingWest=[&](){return targetDirection>=3*PI/4||targetDirection<-3*PI/4;};
|
||||
auto FacingSouth=[&](){return targetDirection<=3*PI/4&&targetDirection>PI/4;};
|
||||
auto FacingNorth=[&](){return targetDirection>=-3*PI/4&&targetDirection<-PI/4;};
|
||||
|
||||
switch(GetClass()){
|
||||
case Class::WARRIOR:
|
||||
case Class::THIEF:{
|
||||
if(FacingNorth()){
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_N");
|
||||
}else
|
||||
if(FacingSouth()){
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_S");
|
||||
}else
|
||||
if(FacingWest()){
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_W");
|
||||
}else
|
||||
if(FacingEast()){
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_E");
|
||||
}
|
||||
}break;
|
||||
case Class::RANGER:
|
||||
case Class::TRAPPER:{
|
||||
if(FacingNorth()){
|
||||
UpdateAnimation("RANGER_SHOOT_N");
|
||||
}else
|
||||
if(FacingSouth()){
|
||||
UpdateAnimation("RANGER_SHOOT_S");
|
||||
}else
|
||||
if(FacingWest()){
|
||||
UpdateAnimation("RANGER_SHOOT_W");
|
||||
}else
|
||||
if(FacingEast()){
|
||||
UpdateAnimation("RANGER_SHOOT_E");
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,21 +83,10 @@ bool Warrior::AutoAttack(){
|
||||
}
|
||||
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
||||
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
||||
|
||||
float dirToEnemy=geom2d::float<rect>(GetPos(),closest->GetPos()).vector().polar().y;
|
||||
SetState(State::SWING_SWORD);
|
||||
switch(facingDirection){
|
||||
case DOWN:{
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_S",WARRIOR|THIEF);
|
||||
}break;
|
||||
case RIGHT:{
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_E",WARRIOR|THIEF);
|
||||
}break;
|
||||
case LEFT:{
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_W",WARRIOR|THIEF);
|
||||
}break;
|
||||
case UP:{
|
||||
UpdateAnimation("WARRIOR_SWINGSWORD_N",WARRIOR|THIEF);
|
||||
}break;
|
||||
}
|
||||
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
||||
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
||||
}
|
||||
return true;
|
||||
|
@ -580,7 +580,7 @@
|
||||
<property name="Connection 2 - East" type="object" value="8"/>
|
||||
<property name="Map" propertytype="Level" value="STORY_1_1"/>
|
||||
<property name="Type" propertytype="StageType" value="STORY"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_1"/>
|
||||
<property name="Unlock Condition" propertytype="Level" value="WORLD_MAP"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="6" name="Stage III" type="StagePlate" x="196" y="636" width="44" height="16">
|
||||
|
Loading…
x
Reference in New Issue
Block a user