Jump to content


Photo

Drawing a Heads Up Display


  • Please log in to reply
2 replies to this topic

#1 nathantcash

nathantcash

    GMC Member

  • GMC Member
  • 77 posts
  • Version:GM8

Posted 23 May 2012 - 10:57 PM

I have been trying to add a hud in my game that spans the width of the current view and is below my character. So far I have easily been able to make it below my character but I don't know how to make it stay in the view. If anyone has any methods or examples, please share.
  • 0

#2 C_Pike

C_Pike

    GMC Member

  • GMC Member
  • 565 posts
  • Version:GM8.1

Posted 23 May 2012 - 11:02 PM

Here's a topic on it
http://gmc.yoyogames...howtopic=495938
  • 0

#3 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2748 posts
  • Version:GM:Studio

Posted 23 May 2012 - 11:59 PM

When drawing relative to an object, you use it's coordinates, or built-in variables: x , y . When drawing relative to a VIEW, each view also has it's own coordinates: view_xview[#] , view_yview[#].

The # should be replaced with the number of the view, and these coordinates should return the top left corner of the view. When you draw a hud, you should use the draw event (don't re-position in the step event, as it makes things lag behind the view a little during movement) and draw functions such as draw_sprite() or :GM108: to draw the hud. Simply place in the variables given above, plus the number of pixels right or down of that spot that you wish to draw that HUD item.

Hope this helps.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users