• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED]trying to draw non-existing sprite

Pfap

Member
When I run this in a draw event I get a crashing error
Code:
if global.my_turn{
 draw_set_valign(fa_middle);
 draw_set_halign(fa_left);
 draw_sprite(32,64,0,visual_guide); }
else{
 draw_set_valign(fa_middle);
 draw_set_halign(fa_right);

 draw_sprite(256,64,0,visual_guide); }
}
The sprite visual_guide is drawn fine until global.my_turn is set to false; at which point the game crashes and I get the trying to draw non-existing sprite error.

I'm not sure what's going on and I don't think it's a bug. I have 3 other objects with draw events in the room and I've also imported a lot of sprites by using the add existing option and grabbing stuff from other projects.

Also, I found a work around by setting the sprite_index of the object from the resource tree and then running this.

Code:
if global.my_turn == false{
 //this object's x = 256 y = 64
 draw_self();
 
}
Just wondering if anybody has any insight as to what could be going on here? Or if it could be my resource tree is messed up somehow?
 
  • Wow
Reactions: Mut

Pfap

Member
Your arguments for draw_sprite are twisted.
sprite index
image index
x
y

should be the order.
Oh my goodness?!!!?!??!?! Thank you wow lol I'm beside myself and sprite_indexes are real and in my debug it did work out to the number 74, so everything makes perfect sense again!!
 
Top