Need help for a hud

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Aënahel
Posts: 3
Joined: Fri May 11, 2007 11:54 am

Need help for a hud

Post by Aënahel »

Hello ! :D I'm working on a First Person Shooter, and I want to add a hud (like stats, current weapon, ammo, radar, timer etc etc).

But I don't know how to manage :oops: . I placed a 2d weapon looking like counter strike on my screen, but I only know how to set pictures. I would like to be able to remove them, to move them etc...

My questions are :

1) How do you move/remove/resize images with Irrlicht ?
2) How do you create a timer ? ("00:57:96" format) which wou can start/stop, and how do you place it on your screen ?
3) How do you make a radar, showing a circular sector of the map, with green and red dots for the players ?
4) (if possible ^^') How to move other player with artificial intelligence ? :mrgreen:

And if you know how to do other cool things for my hud, just tell me please ^^.

Thanx,
Aen :)
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

1) see sprite tutorial
2a) get access to Irrlicht timer, b) I leave to you to convert to string in the format you want, c) see the gui example (or pre-render number/letters sprite then use the sprite tutorial)
3) For the background: read the sprite tutorial, for the line, search for Draw2DLine, for the glowing after effect, either search for rotating billboard/sprite on the forum or apply the texture on a quad then rotate it, for the dots, either use sprite, a Draw2DLine, or an equivalent for points, for finding where to draw, it all depends how your system works. I'll take a guess and assume you want it to display enemies based on their x, z position and only if they are within a certain range in y? in which case, go through the list of all potential allies and enemies, make a point at coordinate

vector3df NPCPos = NPC.getAbsolutePosition();
vector3df PlayPos = Player.getAbsolutePosition();

If (NPCPos.y - PlayPos.y > -Blah && NPCPos.y - PlayPos.y < Blah)
{
DrawPointSomehow((NPCPos.x - PlayPos.x) * Modifier_of_size_on_your_map_for_x, (NPCPos.z - PlayPos.z) * Modifier_of_size_on_your_map_for_z);
}
4) Search for Artificial Intelligence everywhere. That in itself is a topic extremely hard if you're looking for anything good.
dejai
Posts: 522
Joined: Sat Apr 21, 2007 9:00 am

Post by dejai »

This is a very intresting thred and I am also intreseted in this topic.
Programming Blog: http://www.uberwolf.com
LemonMan
Posts: 16
Joined: Sat May 26, 2007 4:49 pm
Location: Duluth, Minnesota, U.S.A.
Contact:

Post by LemonMan »

I am interested in how the radar will turn out. :)
GO HERE NOW! please? :)
My friends website - http://www.ecoblues.net/joomla/

My website - http://www.harborcityschool.net/~pjewell
Aënahel
Posts: 3
Joined: Fri May 11, 2007 11:54 am

Post by Aënahel »

Thanx a lot, Dorth :D

These are useful hints. But I was wondering how to access Irrlicht's timer, in order to get real time ? :?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

device->getTimer() will return you a pointer to the Irrlicht timer. It has methods for accessing the time as milliseconds since some arbitrary start time.

If you want to get the wall clock time, you should use one of the C library time functions. strftime() [or wcsftime()] can format the date/time as a string in pretty much any format you want. If you just want the time/date as data, you can use localtime().

Travis
Post Reply