1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Drag And Drop [SOLVED] Variable not being drawn...

Discussion in 'Programming' started by Dr_Nomz, Oct 17, 2018.

  1. Dr_Nomz

    Dr_Nomz Member

    Joined:
    Oct 31, 2016
    Posts:
    619
    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?
     
  2. spe

    spe Member

    Joined:
    Aug 25, 2016
    Posts:
    102
    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.
     
  3. dannyjenn

    dannyjenn Member

    Joined:
    Jul 29, 2017
    Posts:
    569
    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.)
     
  4. Weird Dragon

    Weird Dragon Wizard GMC Elder

    Joined:
    Apr 21, 2016
    Posts:
    125
    @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.
     
    dannyjenn likes this.
  5. Dr_Nomz

    Dr_Nomz Member

    Joined:
    Oct 31, 2016
    Posts:
    619
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice