Jump to content


Photo

drawing text


  • Please log in to reply
5 replies to this topic

#1 Kill...

Kill...

    GMC Member

  • New Member
  • 94 posts
  • Version:GM8

Posted 03 March 2012 - 09:19 PM

In the draw event for my object i put
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.
  • 0

#2 Exony

Exony

    GMC Member

  • New Member
  • 18 posts

Posted 03 March 2012 - 09:21 PM

also add
draw_sprite(spritename,spritename,x,y)
replacing spritename with your sprites designated name.
  • 0

#3 greep

greep

    Menaces with Spikes

  • GMC Member
  • 2297 posts
  • Version:GM7

Posted 03 March 2012 - 09:29 PM

or add draw_self() in GM8

Edited by greep, 03 March 2012 - 09:29 PM.

  • 0

#4 Kill...

Kill...

    GMC Member

  • New Member
  • 94 posts
  • Version:GM8

Posted 03 March 2012 - 09:33 PM

also add

draw_sprite(spritename,spritename,x,y)
replacing spritename with your sprites designated name.

thanks it worked
  • 0

#5 Exony

Exony

    GMC Member

  • New Member
  • 18 posts

Posted 03 March 2012 - 09:45 PM

Yeah, just remember putting any draw code into the draw function will make the sprite not show.
  • 0

#6 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16810 posts
  • Version:GM:Studio

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!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users