Jump to content

Recommended Posts

Posted

I am trying to make a new HUD to add onto my game (similar to an experience bar). I have it rendering onto the screen, the only problem I am having is with the placement of it. Since the placement goes by pixels, what may be the perfect location on a full screen may be located in the middle of the screen if the player re-sizes the window. How could I make it fixed in a certain location relative to the game? For example, the hotbar and experience bars are always in the bottom-center of the screen.

Posted

There are two variables in every GUI class. They are width and height. As you may or may not assume, these are the width and height of the screen.

 

If you wanted to have the TOP LEFT of the image for the HUD drawn in the very center of the screen, you would draw it at x location width / 2, and y location height / 2.

 

I hope that helps :)

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.