Page 1 of 2

More Noob Questions

Posted: Tue Jun 26, 2007 12:52 am
by LemonMan
I'm very new to Irrlicht and think that it's an awesome project.
I have some questions about how to do things in a First Person Shooter type game.

How would I setup a health/armor bar/percentage counter?
How would I setup a HUD? Weapon and ammo. Put a picture of the current weapon in the HUD.
How would I make it so that when you press escape it brings up a menu?
How would I make a menu? With mission info, options, and exit buttons.
How would I make a mirror (like a bathroom mirror?)

I have been modifying the code from the Tutorials, Mainly the "Collision" tutorial, if anyone has any examples of how to do these things...

Please and Thankyou! :)

Posted: Tue Jun 26, 2007 1:07 am
by JonLT
thats really a lot of different things.
For the health/ammo and stuff i guess you should use the irrlicht gui.
The weapon could be a mesh locked in front of the camera as a child (or with bones? ).
For the menu, you'd need an event receiver to get the input and a gui to draw the menu.
A mirror is rather complicated, something with render to texture i guess.

I've seen all the things explained in this forum, so you just need to do some searching.

good luck! :)

Posted: Tue Jun 26, 2007 2:16 am
by Tocs1001
Huds and health bars are considered GUI which can be really really really ...really... (did I mention really) annoying. Irrlicht has gui built into it but its not custom to the game its got a generic look. you can put 2D Images on the screen. So just combine a bunch of images positioned right to look like your hud. Stretch the image of the health bar to be a gage.

equation as follows...

WidthOfHealthBar = (Health/MaxHealth)*MaxWidthOfHealthBar;


As for reflections. I forget where the post was but some guy made a cool reflective water, you could borrow the shader and stick it on a flat surface and call it a mirror

Posted: Tue Jun 26, 2007 3:08 am
by LemonMan
I tryed doing some gui stuff like text but could NOT do it...

Posted: Tue Jun 26, 2007 5:42 am
by Dances
There is a GUI tutorial... modify that.

Posted: Tue Jun 26, 2007 10:34 pm
by LemonMan
OHHHH!

You have to draw the gui...

lol

Another question how do you make the text bigger? I can barely see it right now. And is it easy to use a different font?

Also, with the gui some of the peramaters of some commands are extremely wierd. Do you just get used to them after a while?

Posted: Tue Jun 26, 2007 11:26 pm
by Masterhawk
Perhaps you schould use the IrrFontTool for that....just create a larger fontset...
the IrrFontTool is also delivered with the SDK.....

Posted: Tue Jun 26, 2007 11:27 pm
by Dances
the 2d graphics tutorial I believe shows how to change the font.
Can you give an example of a wierd parameter?

Posted: Wed Jun 27, 2007 1:39 am
by LemonMan
Not just with the gui but wenever you do some thing like addCubeScenenode

You have to put in stuff like <s32> and L before text and stuff that I don't understand...[/code]

Posted: Wed Jun 27, 2007 11:17 am
by LLDD
LemonMan wrote:Not just with the gui but wenever you do some thing like addCubeScenenode

You have to put in stuff like <s32> and L before text and stuff that I don't understand...[/code]
Those are templates. Google it for further information.
________
IOLITE VAPORIZER REVIEW

Posted: Wed Jun 27, 2007 7:21 pm
by LemonMan
How do you print a variable to the screen?
Like if I was trying to make a health counter.

I tryed this but it didn't work...
addStaticText(L"Health:" health)

Posted: Wed Jun 27, 2007 8:02 pm
by Dances
LemonMan wrote:How do you print a variable to the screen?
Like if I was trying to make a health counter.

I tryed this but it didn't work...
addStaticText(L"Health:" health)
You need to make a wchar_t and put that in there instead of "L"Health:" health".

You should also use setText or whatever it is, because if you addStaticText its just going to leave the old text and add new text on top every frame.

Posted: Wed Jun 27, 2007 8:30 pm
by LemonMan
What's a wchar_t and how would I use it?

Posted: Thu Jun 28, 2007 1:49 am
by Dances
its a variable type, just like int, float, or char.

Posted: Thu Jun 28, 2007 10:25 am
by dejai
Hey I think a tutorial section will be coming to my website soon on basic C++ coding :D