Updating the map position in the loop before the character runs?

Doesn’t this create drift between the “actual” ticked position of the character and the map? EG won’t this cause 1 frame off collisions later? With higher framerates this doesn’t matter too much, but encapsulating the map’s offset within the character’s tick method feels problematic.

With the map movement we’re faking the idea of a camera being present. Doing that means we actually move the map instead of the player.

Sure, but isn’t the tick of the character is calculating the position for the camera? So we sort of pre-calculate the characters next map position (and the enemy positions later) and do a collision check before we actually render that position (in the next frame).

This might matter if the gameplay was super precise, I’ve tried it with the mapPos being updated before or after the knight with no noticeable difference in gameplay.

We do need to draw the map first because of how sprites/images are layered when drawing them.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms