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
2895defa43
commit
cbf323da89
Adventures in Lestoria
@ -2008,6 +2008,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
|||||||
LoadingScreen::Reset();
|
LoadingScreen::Reset();
|
||||||
previousLevel=currentLevel;
|
previousLevel=currentLevel;
|
||||||
currentLevel=map;
|
currentLevel=map;
|
||||||
|
loadingWaitTime=0.f;
|
||||||
|
|
||||||
#pragma region Reset all data (Loading phase 1)
|
#pragma region Reset all data (Loading phase 1)
|
||||||
LoadingScreen::AddPhase([&](){
|
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));
|
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){
|
void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){
|
||||||
if(GetClass()==Class::RANGER){
|
auto FacingEast=[&](){return targetDirection<=PI/4&&targetDirection>-PI/4;};
|
||||||
if(targetDirection<=PI/4&&targetDirection>-PI/4){
|
auto FacingWest=[&](){return targetDirection>=3*PI/4||targetDirection<-3*PI/4;};
|
||||||
UpdateAnimation("RANGER_SHOOT_E");
|
auto FacingSouth=[&](){return targetDirection<=3*PI/4&&targetDirection>PI/4;};
|
||||||
} else
|
auto FacingNorth=[&](){return targetDirection>=-3*PI/4&&targetDirection<-PI/4;};
|
||||||
if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){
|
|
||||||
UpdateAnimation("RANGER_SHOOT_W");
|
switch(GetClass()){
|
||||||
} else
|
case Class::WARRIOR:
|
||||||
if(targetDirection<=3*PI/4&&targetDirection>PI/4){
|
case Class::THIEF:{
|
||||||
UpdateAnimation("RANGER_SHOOT_S");
|
if(FacingNorth()){
|
||||||
} else
|
UpdateAnimation("WARRIOR_SWINGSWORD_N");
|
||||||
if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){
|
}else
|
||||||
UpdateAnimation("RANGER_SHOOT_N");
|
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();
|
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
||||||
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
||||||
|
|
||||||
|
float dirToEnemy=geom2d::float<rect>(GetPos(),closest->GetPos()).vector().polar().y;
|
||||||
SetState(State::SWING_SWORD);
|
SetState(State::SWING_SWORD);
|
||||||
switch(facingDirection){
|
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
||||||
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;
|
|
||||||
}
|
|
||||||
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -580,7 +580,7 @@
|
|||||||
<property name="Connection 2 - East" type="object" value="8"/>
|
<property name="Connection 2 - East" type="object" value="8"/>
|
||||||
<property name="Map" propertytype="Level" value="STORY_1_1"/>
|
<property name="Map" propertytype="Level" value="STORY_1_1"/>
|
||||||
<property name="Type" propertytype="StageType" value="STORY"/>
|
<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>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
<object id="6" name="Stage III" type="StagePlate" x="196" y="636" width="44" height="16">
|
<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