World shake fixes again (so it's not tied to FPS)
This commit is contained in:
parent
2fe9f17cdc
commit
395b2e3ab8
@ -388,13 +388,12 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
|||||||
void Crawler::UpdateCamera(float fElapsedTime){
|
void Crawler::UpdateCamera(float fElapsedTime){
|
||||||
lastWorldShakeAdjust=std::max(0.f,lastWorldShakeAdjust-fElapsedTime);
|
lastWorldShakeAdjust=std::max(0.f,lastWorldShakeAdjust-fElapsedTime);
|
||||||
if(worldShakeTime-fElapsedTime>0){
|
if(worldShakeTime-fElapsedTime>0){
|
||||||
worldShakeVel={1000,-1000};
|
|
||||||
if(lastWorldShakeAdjust==0){
|
if(lastWorldShakeAdjust==0){
|
||||||
lastWorldShakeAdjust=0.04;
|
lastWorldShakeAdjust=0.02;
|
||||||
worldShakeVel.x*=-1;
|
worldShakeVel.x*=-1;
|
||||||
worldShakeVel.y*=-1;
|
worldShakeVel.y*=-1;
|
||||||
}
|
}
|
||||||
worldShake=player->GetPos()+worldShakeVel*fElapsedTime;
|
worldShake=player->GetPos()+worldShakeVel;
|
||||||
}else{
|
}else{
|
||||||
camera.SetTarget(player->GetPos());
|
camera.SetTarget(player->GetPos());
|
||||||
}
|
}
|
||||||
@ -1147,7 +1146,7 @@ vf2d Crawler::GetWorldMousePos(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Crawler::SetupWorldShake(float duration){
|
void Crawler::SetupWorldShake(float duration){
|
||||||
worldShakeVel={750,-750};
|
worldShakeVel={13,-13};
|
||||||
worldShakeTime=duration;
|
worldShakeTime=duration;
|
||||||
worldShake=vf2d{player->GetPos()};
|
worldShake=vf2d{player->GetPos()};
|
||||||
camera.SetTarget(worldShake);
|
camera.SetTarget(worldShake);
|
||||||
@ -1580,6 +1579,7 @@ int main()
|
|||||||
std::cout<<line<<std::endl;
|
std::cout<<line<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(leaked)ERR("")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 2638
|
#define VERSION_BUILD 2642
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user