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