draw_text(0,0,"Nukes: "+string(bomb_amount)) draw_set_color(c_white) draw_set_font(my_font)The code works but it makes my object invisible so i need help.
drawing text
Started by Kill..., Mar 03 2012 09:19 PM
5 replies to this topic
#1
Posted 03 March 2012 - 09:19 PM
In the draw event for my object i put
#2
Posted 03 March 2012 - 09:21 PM
also add
draw_sprite(spritename,spritename,x,y)replacing spritename with your sprites designated name.
#3
Posted 03 March 2012 - 09:29 PM
or add draw_self() in GM8
Edited by greep, 03 March 2012 - 09:29 PM.
#4
Posted 03 March 2012 - 09:33 PM
thanks it workedalso add
draw_sprite(spritename,spritename,x,y)replacing spritename with your sprites designated name.
#5
Posted 03 March 2012 - 09:45 PM
Yeah, just remember putting any draw code into the draw function will make the sprite not show.
#6
Posted 03 March 2012 - 09:51 PM
To expand :
GameMaker default draws the sprite that the object has WHEN THE DRAW EVENT HAS NO CODE. This means that you can apply any transforms (image_xscale, image_alpha etc...) in other steps and they will show. However, the moment you add code to the draw event you are basically saying "hey, GM! I´m in charge and I´ll tell you what to draw!". So, GM only draws what you tell it to, in this case the text. So, to tell it to draw the sprite of the object too, you need to use either :
draw_self() : This is the same as default drawing
draw_sprite() : This will draw the sprite but NO transforms
draw_sprite_ext() : This will draw the sprite and any transforms depending on what values you use for it.
Hope that clears up any confusion!
GameMaker default draws the sprite that the object has WHEN THE DRAW EVENT HAS NO CODE. This means that you can apply any transforms (image_xscale, image_alpha etc...) in other steps and they will show. However, the moment you add code to the draw event you are basically saying "hey, GM! I´m in charge and I´ll tell you what to draw!". So, GM only draws what you tell it to, in this case the text. So, to tell it to draw the sprite of the object too, you need to use either :
draw_self() : This is the same as default drawing
draw_sprite() : This will draw the sprite but NO transforms
draw_sprite_ext() : This will draw the sprite and any transforms depending on what values you use for it.
Hope that clears up any confusion!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











