draw_sprite lagging behind 1 frame

SirCaliber

Member
Hey guys!
So I've got a bit of a problem - when using draw_sprite, the player object is drawn first, then the glasses sprite in draw_sprite is being drawn on top of it, which is intended. However, the problem is that the glasses sprite is being drawn 1 frame after the object is being drawn. I'm using the normal Draw event as well. I've tried to use the Start Draw and the End Draw event but that just results in everything being invisible.

I'm sure i'm missing something simple since I've fixed problems like this before. Thanks for any help.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Are these being drawn from the same instance or separate instances? If it's the latter, make sure to update the glasses' position in the player object after their movement has been handled or the End Step event of the glasses, as you're otherwise at the mercy of the event execution order. The end result (well, one possible end result) of that is the issue you're describing.
 

SirCaliber

Member
Are these being drawn from the same instance or separate instances? If it's the latter, make sure to update the glasses' position in the player object after their movement has been handled or the End Step event of the glasses, as you're otherwise at the mercy of the event execution order. The end result (well, one possible end result) of that is the issue you're describing.
No, the glasses are simply a sprite being drawn by the player instance using draw_sprite. I can't send the exact code right now since i'm away from my computer but i'll try my best to replicate it here:

GML:
draw_self()
draw_sprite_ext(sGlasses,0,x,y,image_xscale,image_yscale,image_angle,c_white,image_alpha)
 

TsukaYuriko

☄️
Forum Staff
Moderator
That code should have no chance for anything to lag behind. But as you said, that's not the exact code, so seeing that may shed some new light on this issue.

Does this only happen when moving? If the positioning is also off when standing still, check the sprites' origins to make sure they line up.
 

SirCaliber

Member
That code should have no chance for anything to lag behind. But as you said, that's not the exact code, so seeing that may shed some new light on this issue.

Does this only happen when moving? If the positioning is also off when standing still, check the sprites' origins to make sure they line up.
The sprite's origin lines up exactly with the player, and when standing still, yes it appears in the correct position. And yes, it does only happen when moving --- but only the X and Y are lagging behind, not the image angle or anything else.
 
Top