Smooth movement should respect elapsed time and not be frame-based.

pull/30/head
sigonasr2 1 year ago
parent 87cdff2218
commit 20e452b337
  1. 4
      Adventures in Lestoria/Monster.cpp
  2. 4
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Version.h
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -136,7 +136,7 @@ bool Monster::_SetX(float x,const bool monsterInvoked){
vf2d pushDir=geom2d::line<float>(collision.middle(),pos).vector().norm();
newPos={newPos.x,pos.y+pushDir.y*12};
if(NoEnemyCollisionWithTile()){
return _SetY(pos.y+pushDir.y,false);
return _SetY(pos.y+pushDir.y*game->GetElapsedTime()*12,false);
}
}
}
@ -166,7 +166,7 @@ bool Monster::_SetY(float y,const bool monsterInvoked){
vf2d pushDir=geom2d::line<float>(collision.middle(),pos).vector().norm();
newPos={pos.x+pushDir.x*12,newPos.y};
if(NoEnemyCollisionWithTile()){
return _SetX(pos.x+pushDir.x,false);
return _SetX(pos.x+pushDir.x*game->GetElapsedTime()*12,false);
}
}
}

@ -131,7 +131,7 @@ bool Player::_SetX(float x,const bool playerInvoked){
vf2d pushDir=geom2d::line<float>(collision.middle(),pos).vector().norm();
newPos={newPos.x,pos.y+pushDir.y*12};
if(NoPlayerCollisionWithTile()){
return _SetY(pos.y+pushDir.y,false);
return _SetY(pos.y+pushDir.y*game->GetElapsedTime()*12,false);
}
}
}
@ -164,7 +164,7 @@ bool Player::_SetY(float y,const bool playerInvoked){
vf2d pushDir=geom2d::line<float>(collision.middle(),pos).vector().norm();
newPos={pos.x+pushDir.x*12,newPos.y};
if(NoPlayerCollisionWithTile()){
return _SetX(pos.x+pushDir.x,false);
return _SetX(pos.x+pushDir.x*game->GetElapsedTime()*12,false);
}
}
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 5737
#define VERSION_BUILD 5740
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save