So, recently I've found myself in this problem that makes every Entity (that is not centered or doesn't have the same speed as the centered Entity) make this strange "flickering" while updates it's position, take a look: (I didn't put any reference object, but the Entities are actually moving to the right --->)
I think it's being caused by the update logic:
void Entity::update(Uint32 ticks)
{
if (ticks > lastUpdate + 2000 - 1974 - myVelocity)
{
posX += velocityX;
posY += velocityY;
lastUpdate = ticks;
}
}
And I know that this logic is terrible and will fail, because it even if the update logic is not the root of the problem I need to change it to something better. My questions are, where is my error? How can I find my error? Can I find a better logic to make the movement more smooth? what do I need to search for to implement a new logic?
Forgot to mention but, the skeleton's velocity is 2 Pixels per second and the frog's velocity is 1 Pixel per second.