Merge conflict
This commit is contained in:
commit
745a85aa55
@ -52,13 +52,12 @@ private:
|
||||
void InitializeClassAbilities();
|
||||
public:
|
||||
Crawler();
|
||||
|
||||
bool OnUserCreate() override;
|
||||
bool OnUserUpdate(float fElapsedTime) override;
|
||||
public:
|
||||
geom2d::rect<int>NO_COLLISION={};
|
||||
vi2d WORLD_SIZE={120,8};
|
||||
TileTransformedView view;
|
||||
bool OnUserCreate() override;
|
||||
bool OnUserUpdate(float fElapsedTime) override;
|
||||
void InitializeLevel(std::string mapFile,MapName map);
|
||||
void LoadLevel(MapName map);
|
||||
void HandleUserInput(float fElapsedTime);
|
||||
|
@ -319,7 +319,7 @@ void Player::Update(float fElapsedTime){
|
||||
}
|
||||
|
||||
|
||||
auto AllowedToCast=[&](Ability&ability){return !ability.precastInfo.precastTargetingRequired;};
|
||||
auto AllowedToCast=[&](Ability&ability){return !ability.precastInfo.precastTargetingRequired&&GetState()!=State::ANIMATION_LOCK;};
|
||||
//If pressed is set to false, uses held instead.
|
||||
auto CheckAndPerformAbility=[&](Ability&ability,HWButton key){
|
||||
if(ability.name!="???"){
|
||||
@ -439,7 +439,7 @@ vf2d Player::GetVelocity(){
|
||||
}
|
||||
|
||||
bool Player::CanMove(){
|
||||
return state!=State::CASTING;
|
||||
return state!=State::CASTING&&state!=State::ANIMATION_LOCK;
|
||||
}
|
||||
|
||||
bool Player::HasIframes(){
|
||||
@ -581,16 +581,18 @@ void Player::SetVelocity(vf2d vel){
|
||||
}
|
||||
|
||||
void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){
|
||||
if(targetDirection<=PI/4&&targetDirection>-PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_E);
|
||||
} else
|
||||
if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_W);
|
||||
} else
|
||||
if(targetDirection<=3*PI/4&&targetDirection>PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_S);
|
||||
} else
|
||||
if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_N);
|
||||
if(GetClass()==Class::RANGER){
|
||||
if(targetDirection<=PI/4&&targetDirection>-PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_E);
|
||||
} else
|
||||
if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_W);
|
||||
} else
|
||||
if(targetDirection<=3*PI/4&&targetDirection>PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_S);
|
||||
} else
|
||||
if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){
|
||||
UpdateAnimation(AnimationState::RANGER_SHOOT_N);
|
||||
}
|
||||
}
|
||||
}
|
@ -89,6 +89,10 @@ protected:
|
||||
float ghostRemoveTimer=0;
|
||||
float retreatTimer=0;
|
||||
std::vector<vf2d>ghostPositions;
|
||||
float rapidFireTimer=0;
|
||||
int remainingRapidFireShots=0;
|
||||
const float RAPID_FIRE_SHOOT_DELAY=0.1;
|
||||
const int RAPID_FIRE_SHOOT_AMOUNT=4;
|
||||
public:
|
||||
Player();
|
||||
//So this is rather fascinating and only exists because we have the ability to change classes which means we need to initialize a class
|
||||
|
@ -29,7 +29,38 @@ 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(){
|
||||
@ -40,11 +71,11 @@ bool Ranger::AutoAttack(){
|
||||
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)));
|
||||
SetState(State::SHOOT_ARROW);
|
||||
SetAnimationBasedOnTargetingDirection(angleToCursor);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Ranger::InitializeClassAbilities(){
|
||||
#pragma region Ranger Right-click Ability (???)
|
||||
#pragma region Ranger Right-click Ability (Retreat)
|
||||
Ranger::rightClickAbility.action=
|
||||
[](Player*p,vf2d pos={}){
|
||||
geom2d::line mouseDir{game->GetWorldMousePos(),p->GetPos()};
|
||||
@ -61,10 +92,13 @@ void Ranger::InitializeClassAbilities(){
|
||||
return true;
|
||||
};
|
||||
#pragma endregion
|
||||
#pragma region Ranger Ability 1 (???)
|
||||
#pragma region Ranger Ability 1 (Rapid Fire)
|
||||
Ranger::ability1.action=
|
||||
[](Player*p,vf2d pos={}){
|
||||
return false;
|
||||
p->remainingRapidFireShots=p->RAPID_FIRE_SHOOT_AMOUNT;
|
||||
p->rapidFireTimer=p->RAPID_FIRE_SHOOT_DELAY;
|
||||
p->SetState(State::ANIMATION_LOCK);
|
||||
return true;
|
||||
};
|
||||
#pragma endregion
|
||||
#pragma region Ranger Ability 2 (???)
|
||||
|
@ -14,4 +14,5 @@ enum State{
|
||||
PREP_CAST,
|
||||
SHOOT_ARROW,
|
||||
RETREAT,
|
||||
ANIMATION_LOCK,
|
||||
};
|
0
Crawler/loc.sh
Normal file → Executable file
0
Crawler/loc.sh
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user