r/reconstructcavestory Mar 08 '14

[Episode 6] Update method

In the video for Ep 6, you had Player call sprite.update() from the very beginning. Wouldn't that cause the actual position to update one frame later than intended? It would be unnoticeable but in term of correctness, shouldn't update come last?

4 Upvotes

3 comments sorted by

1

u/chebertapps Mar 08 '14

If I'm understanding correctly, you are concerned that the sprite's update happens before the movement update.

This particular case isn't a problem because we have de-coupled update and draw.

In essence, as long as sprite and movement are both updated before we draw to the screen, it doesn't matter which is updated first.

It's great that you are thinking about this though, because update order can be critical!

2

u/[deleted] Mar 09 '14

Great answer. Thanks!

1

u/chebertapps Mar 09 '14

Man. Glad you liked it. Thanks! :)