Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / HUD Ideas

Author
Message
Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 23rd Jul 2006 07:29
I'm working on a game, and I'm designing a HUD right now, but I've never really made a HUD before, so I've got a couple questions, and any answers you guys could provide would be great:

1 - I would like to have a mini-map/radar thing in the top right of the screen. Would it be better to use set camera to image and position a camera of the scene, or use a pre-made image? And, if I used a pre-made image, how would I rotate it and crop it so that I could put it in a sprite? (I'll probably just make the radar/minimap square or rectangular, to make it easier)

2 - I'd like to have a spedometer - just a simple, pre-loaded, circular image with a small needle. However, how could I add the needle over top of the other image and get it to draw correctly? Possible one sprite over top of the other?

3 - I'd like to be able to call up a binocular-type "zoom" view in the top left of the screen. I assume I'd position a camera at my character's position and set the FOV to create the zoom affect, and then use set camera to image. However, is there any way to apply a mask to the image, so that it's in a binocular-type shape?

Thanks in advance for any help you can provide,
bmad6

Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 23rd Jul 2006 11:59 Edited at: 23rd Jul 2006 13:19
1) Entirely your choice. You have told us nothing about the game or its style, so we can't offer any help.

2) You are correct ... one sprite on top of another. Use SET SPRITE PRIORITY to ensure you have them display as you would like.

3) Simply make a black shape with a transparent centre in the shape that you want and either set it as a sprite which will cover all 3D objects or apply it as a texture to a plain and DISABLE OBJECT ZDEPTH to ensure that it obscures all 3D objects. Also if using the second option you will need to turn on object transparency.


Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 23rd Jul 2006 12:09 Edited at: 23rd Jul 2006 12:10
Here ... a quick binocular mask for you. Iv'e blurred the edges slightly which is to be expected because your eyes would b focused on the more distant view.




Attachments

Login to view attachments
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 23rd Jul 2006 13:18 Edited at: 25th Jul 2006 20:20
Please forgive the triple post but it was neccessary because of the attachments.

I had some spare time so I knocked up a working demo for binocular view. Attached is an EXE with media and source code.
Use the arrow keys and mouse to move around and press 'B' to use binoculars.
I have also implemented a zoom function, so that instead of just flicking between normal and binocular views, there is a transition between them.

Here is the code (in case you want to see what I have done without having to download anything)


And here is what it looks like running:

Normal View:


Zoomed View:



Attachments

Login to view attachments
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 23rd Jul 2006 13:23
check my post in the bottom of this thread
Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 23rd Jul 2006 18:36
Thanks, scraggle, that's really helpful! That solves just about everything right there!

And, I'll check out that thread too, CuCuMBeR...

Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 23rd Jul 2006 18:56
Okay, I've looked at that post CuCuMBeR, and although it's a nice idea, I probably just want to go with a premade image, for simplicity and speed, with a simple 2D diagram of the map. The problem is:

I have my image, and I know how much I want to rotate it and what part of the image I should use. However, how do I crop a [rectangular or circular] section from that image and display only that on the screen?

(I assume I'll be using a simple sprite to display the minimap)

CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 23rd Jul 2006 19:01
well, check the thread again and read the code carefully and make sure you understand it.Then it will give you an idea how to make a plain object offseted to the screen coordinates and then you can rotate that object as how you want and with a bit of work on your own, you can find a way to show only a part of it or the whole image.
Bmad6
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location: Virginia, United States
Posted: 23rd Jul 2006 19:35
Okay, I've been taking a hard look at that source code, and there are a couple of parts I don't understand:



The line I don't understand is:



why ((scrW - scrH) * 2.5)?

and what does this do:



Then:



This takes the HUD object (hud), adds another texture layer and uses the texture from the bird's-eye camera (1,2), and uses the UV data from the other texture layer (3), but what does the blend mode (5) do?

Login to post a reply

Server time is: 2025-05-16 20:49:28
Your offset time is: 2025-05-16 20:49:28