I wonder what the best way is to move the player. Is it best to always check for movement like I do in the first example of is it better to only access the movement function via the input function like the 2nd example?
-EXAMPLE 1-
while(running)
{
while(event)
{
player.input();
}
logic();
render();
}
logic()
{
player.move();
}
-EXAMPLE 2-
while(running)
{
while(event)
{
player.input();
}
logic();
render();
}
player.input()
{
player.move(direction);
}
player.move(int dir)
{
if(dir == left)
{
xvel += 1;
}
}
I hope I explained it right. Thanks in advance.