Fix centering of camera for overworld map.

This commit is contained in:
2023-11-12 21:02:23 -06:00
parent c41ae8aaf9
commit bc07f58c9a
9 changed files with 32 additions and 18 deletions
+5 -3
View File
@@ -387,15 +387,17 @@ void Crawler::HandleUserInput(float fElapsedTime){
void Crawler::UpdateCamera(float fElapsedTime){
lastWorldShakeAdjust=std::max(0.f,lastWorldShakeAdjust-fElapsedTime);
if(worldShakeTime-fElapsedTime>0){
if(worldShakeTime>0){
worldShakeTime-=fElapsedTime;
if(worldShakeTime<=0){
camera.SetTarget(player->GetPos());
}
if(lastWorldShakeAdjust==0){
lastWorldShakeAdjust=0.02;
worldShakeVel.x*=-1;
worldShakeVel.y*=-1;
}
worldShake=player->GetPos()+worldShakeVel;
}else{
camera.SetTarget(player->GetPos());
}
worldShakeTime=std::max(0.f,worldShakeTime-fElapsedTime);
camera.Update(fElapsedTime);