Fixed camera jerking in a direction really fast.
This commit is contained in:
parent
9a910cfdfd
commit
71abee2a16
|
@ -223,15 +223,13 @@ void doPlayer()
|
||||||
cd = player.x - screen->w / 2;
|
cd = player.x - screen->w / 2;
|
||||||
if (cd < 0)
|
if (cd < 0)
|
||||||
{
|
{
|
||||||
cc = engine.ssx - cameraMaxSpeed;
|
cc = max(cd / 10, max(0, engine.ssx) - cameraMaxSpeed);
|
||||||
limitFloat(&cc, cd / 10, -cd / 10);
|
|
||||||
player.x -= cc;
|
player.x -= cc;
|
||||||
engine.smx -= cc;
|
engine.smx -= cc;
|
||||||
}
|
}
|
||||||
else if (cd > 0)
|
else if (cd > 0)
|
||||||
{
|
{
|
||||||
cc = cameraMaxSpeed + engine.ssx;
|
cc = min(cd / 10, cameraMaxSpeed + min(0, engine.ssx));
|
||||||
limitFloat(&cc, -cd / 10, cd / 10);
|
|
||||||
player.x -= cc;
|
player.x -= cc;
|
||||||
engine.smx -= cc;
|
engine.smx -= cc;
|
||||||
}
|
}
|
||||||
|
@ -254,15 +252,13 @@ void doPlayer()
|
||||||
cd = player.y - screen->h / 2;
|
cd = player.y - screen->h / 2;
|
||||||
if (cd < 0)
|
if (cd < 0)
|
||||||
{
|
{
|
||||||
cc = engine.ssy - cameraMaxSpeed;
|
cc = max(cd / 10, max(0, engine.ssy) - cameraMaxSpeed);
|
||||||
limitFloat(&cc, cd / 10, -cd / 10);
|
|
||||||
player.y -= cc;
|
player.y -= cc;
|
||||||
engine.smy -= cc;
|
engine.smy -= cc;
|
||||||
}
|
}
|
||||||
else if (cd > 0)
|
else if (cd > 0)
|
||||||
{
|
{
|
||||||
cc = cameraMaxSpeed + engine.ssy;
|
cc = min(cd / 10, cameraMaxSpeed + min(0, engine.ssy));
|
||||||
limitFloat(&cc, -cd / 10, cd / 10);
|
|
||||||
player.y -= cc;
|
player.y -= cc;
|
||||||
engine.smy -= cc;
|
engine.smy -= cc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue