|
|
|
@ -88,26 +88,26 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
attack_cooldown_timer=std::max(0.f,attack_cooldown_timer-fElapsedTime); |
|
|
|
|
switch(state){ |
|
|
|
|
case SPIN:{ |
|
|
|
|
switch(lastReleasedMovementKey){ |
|
|
|
|
switch(facingDirection){ |
|
|
|
|
case UP:{ |
|
|
|
|
if(lastAnimationFlip==0){ |
|
|
|
|
lastAnimationFlip=0.03; |
|
|
|
|
lastReleasedMovementKey=DOWN; |
|
|
|
|
facingDirection=DOWN; |
|
|
|
|
animation.ChangeState(internal_animState,AnimationState::WALK_S); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case DOWN:{ |
|
|
|
|
if(lastAnimationFlip==0){ |
|
|
|
|
lastAnimationFlip=0.03; |
|
|
|
|
lastReleasedMovementKey=UP; |
|
|
|
|
facingDirection=UP; |
|
|
|
|
animation.ChangeState(internal_animState,AnimationState::WALK_N); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
if(lastReleasedMovementKey==DOWN||lastReleasedMovementKey==RIGHT){ |
|
|
|
|
spin_angle-=spin_spd*fElapsedTime; |
|
|
|
|
} else { |
|
|
|
|
if(facingDirection==RIGHT){ |
|
|
|
|
spin_angle+=spin_spd*fElapsedTime; |
|
|
|
|
} else { |
|
|
|
|
spin_angle-=spin_spd*fElapsedTime; |
|
|
|
|
} |
|
|
|
|
if(spin_attack_timer>0){ |
|
|
|
|
z=50*sin(3.3*(GROUND_SLAM_SPIN_TIME-spin_attack_timer)/GROUND_SLAM_SPIN_TIME); |
|
|
|
@ -117,10 +117,14 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
spin_angle=0; |
|
|
|
|
z=0; |
|
|
|
|
} |
|
|
|
|
if(lastAnimationFlip>0){ |
|
|
|
|
lastAnimationFlip=std::max(0.f,lastAnimationFlip-fElapsedTime); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
default:{ |
|
|
|
|
//Update animations normally.
|
|
|
|
|
} |
|
|
|
|
[[fallthrough]]; |
|
|
|
|
} |
|
|
|
|
animation.UpdateState(internal_animState,fElapsedTime); |
|
|
|
|
if(attack_cooldown_timer==0&&game->GetMouse(0).bHeld){ |
|
|
|
@ -163,6 +167,14 @@ Key Player::GetLastReleasedMovementKey(){ |
|
|
|
|
return lastReleasedMovementKey; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::SetFacingDirection(Key direction){ |
|
|
|
|
facingDirection=direction; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Key Player::GetFacingDirection(){ |
|
|
|
|
return facingDirection; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::Moved(){ |
|
|
|
|
for(MonsterSpawner&spawner:SPAWNER_LIST){ |
|
|
|
|
if(!spawner.SpawnTriggered()&&geom2d::overlaps(geom2d::circle<float>(pos-vf2d{size*12,size*12},size*12),geom2d::circle<float>(spawner.GetPos(),spawner.GetRange()))){ |
|
|
|
|