GML Visual [SOLVED] Variable not being drawn...

Dr_Nomz

Member
so I managed to initialize a global variable (at least as far as the Debug menu is concerned) and now I want to draw it with a HUD object, but my old way doesn't seem to work for some reason.

It's like this:
obj_Control initializes variables upon creation.
obj_HUD Follows Character (step event, jump to position action) and draws them, like so:
*DRAW event for obj_HUD*
"Color = red"
"Font = fnt_1"
"draw_variable: global.equip_slot, x-50, y-50"

Only, even though both objects exist within the same room, nothing happens. This used to work great for displaying global variables, and even worked when I ran an older game on the same program. (gms1.4)

So am I doing something wrong?
 

spe

Member
Try drawing in the Draw GUI event instead of regular draw event. It automatically draws everything on the screen's position rather than the relative position within the room.
 
D

dannyjenn

Guest
Make sure that you didn't accidentally uncheck 'visible' in obj_HUD.

Also, I recall from your other thread that you had declared equip_slot using globalvar. So I'm not sure about this, but maybe you need to use equip_slot here (not global.equip_slot). (I could be wrong since I don't use Drag and Drop. But I know that in GML you'd just use equip_slot.)
 

Weird Dragon

Wizard
GMC Elder
@dannyjenn just for your information: "globalvar" and the prefix "global." work the same way in both DnD and GML,
By the way "globalvar" is deprecated and is only supported for legacy purposes.
 

Dr_Nomz

Member
Turns out the "relative" option needed to be turned on the Draw Variable action for it to actually FOLLOW the object. :/

Thanks for the help though.
 
Top