Made camera centering more gentle.

This commit is contained in:
onpon4 2015-02-27 01:10:27 -05:00
parent 8e753d9525
commit 5965f44bb1
1 changed files with 12 additions and 40 deletions

View File

@ -220,30 +220,16 @@ void doPlayer()
if (cd < 0)
{
cc = engine.ssx - cameraMaxSpeed;
if (cd < cc)
{
player.x -= cc;
engine.smx -= cc;
}
else
{
player.x -= cd;
engine.smx -= cd;
}
limitFloat(&cc, cd / 10, -cd / 10);
player.x -= cc;
engine.smx -= cc;
}
else if (cd > 0)
{
cc = cameraMaxSpeed + engine.ssx;
if (cd > cc)
{
player.x -= cc;
engine.smx -= cc;
}
else
{
player.x -= cd;
engine.smx -= cd;
}
limitFloat(&cc, -cd / 10, cd / 10);
player.x -= cc;
engine.smx -= cc;
}
}
if (ymoved)
@ -265,30 +251,16 @@ void doPlayer()
if (cd < 0)
{
cc = engine.ssy - cameraMaxSpeed;
if (cd < cc)
{
player.y -= cc;
engine.smy -= cc;
}
else
{
player.y -= cd;
engine.smy -= cd;
}
limitFloat(&cc, cd / 10, -cd / 10);
player.y -= cc;
engine.smy -= cc;
}
else if (cd > 0)
{
cc = cameraMaxSpeed + engine.ssy;
if (cd > cc)
{
player.y -= cc;
engine.smy -= cc;
}
else
{
player.y -= cd;
engine.smy -= cd;
}
limitFloat(&cc, -cd / 10, cd / 10);
player.y -= cc;
engine.smy -= cc;
}
}
}