Failed to try to assign a sprite to a variable

by Boneco Sinforoso   Last Updated August 13, 2019 15:13 PM

I have a game that has 2 sprites:

enter image description here

  • spr_Tela
  • spr_SM

I was having trouble handling the sprite (spr_SM). And I found that the reason was that I couldn't refer to it.

Draw Event:

draw_sprite_ext(spr_Tela,0,room_width/2,room_height/2,10,10,0,c_white,1);
help=draw_sprite_ext(spr_SM,0,(room_width/100)*2,(room_height/100)*10,2,2,0,c_white,1);
xuxu=sprite_get_name(help);
draw_text(room_width-1000,30,xuxu);
draw_text(room_width-900,30,help.x);

So, in theory:

  • help = drawn sprite (spr_SM...)
  • xuxu = get help name (spr_SM)

But in practice, this is not the case:

enter image description here

(see line 4 of the code)

I looked at the documentation and I don't know what I'm doing wrong:

https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/sprites/index.html

What I do know is that variables are always getting the first sprite I created (spr_Tela).



Related Questions


Updated June 06, 2016 08:05 AM

Updated November 29, 2016 08:05 AM

Updated February 21, 2017 07:13 AM

Updated June 25, 2017 17:13 PM

Updated October 24, 2017 06:13 AM