Game Development Community

Text Above Player's Head

by Chosen.Kyle · in Torque Game Engine · 09/01/2005 (12:24 pm) · 11 replies

I'm trying to figure out how to get the damage that is being applied to show above the player's head.

I know that guiShapeNameHUD is exactly what I'm looking for as I have already got the amount of damage you have displayed (basicaly by copying drawName, but replace object->getShapeName() to object->getDamageLevel()). Here's what I need to solve

A) It's not the damage applied.

B) It's displayed constantly

I don't know how to get applyDamage to return the damage value, there is maybe a way to use public vairables for this?

Also I don't know how to display the damage when it is being applied (this way it's not displayed constantly)

I know this is really simple , but I just started with the engine and not sure what to do. Thanks

#1
09/02/2005 (5:28 pm)
So you want a damage indicator to only show up when damage is applied to an object? That might be a litte tricky given that the networking doesn't send each applied damage independently...
#2
09/02/2005 (9:42 pm)
Yea I found that out the hard way, anyways I've kinda thought of some ways around it not to sure if their the best though.

Couldn't you create a guiTextCtrl inside Object::damage set the x,y values to the object and set applyDamage to the text, and deleting the guiTextCtrl when the function finishes execution?

Anyways that's the only thing that comes to mind, I'm going to try and learn a bit more about the engine since I don't know much =P

Any idea's,comments,tips or anything is appreciated =D
#3
09/03/2005 (6:12 pm)
Why not just check to see if the damage info should be drawn before drawing it in the manner of the guishapenamehud? You could even make it fade out after a few (thousand) milliseconds to get a nice effect. Keep track of the "last rendered damage level" and compare to the current one; if it's different then mark the item to be rendered for the next N milliseconds, and fade out over that time. It seems like that would deal with the problem nicely.

In general creating controls on the fly from simulated objects isn't a good idea.
#4
09/05/2005 (7:19 pm)
Ben thats basicaly what I did which did work fine when only one player was in view, there was a problem when 2 players came into view though I didn't look at it too much. I'll check it out into depth and post if there are any problem's I can't solve.

Guess I'm rushing this a bit much.
#5
09/05/2005 (8:20 pm)
I've been thinking of a similar thing for a while with no luck - basically there are plenty of times where it would be great to insert 2d graphics into the torque 3d world - floating "Power Up!!" text, chat balloons, and so on.

On a similar track - is it possible to create a '2dobject' that would appear to players to be perpendicular to them, no matter what angle they were to the actual object.
#6
09/06/2005 (10:14 pm)
@Kyle: Was the problem that you were storing the last touched info on the gui control and not on the individual objects?

@Paul: Sure, they're called billboards and 3space has a variety of ways to effect it.
#7
09/07/2005 (6:18 pm)
Aye Ben that would be the problem. Of course while I was programming it I kinda thought about that but wasn't too sure how it'd turn out. How do I store information/vairbales on an object? I notice most information referenced by the engine was already pre created some where in the engine (can't remember) though if I add a variable to store information on it does the variable have to be added to it's data block?

I don't know to much about this area of the engine or any area's of that matter, but maybe you can provide a link or explain how this section works. It would be greatly appreciated! =D
#8
09/07/2005 (7:41 pm)
In script you can just use %obj.newvar = "info";
%obj been the object
newvar been the variable
and I'm sure you get the rest.
#9
09/08/2005 (7:07 pm)
Though that is for torquescript...
#10
09/08/2005 (8:14 pm)
Quote: mark the item to be rendered for the next N milliseconds, and fade out over that time.

Alright so my method of fading out is actualy really bad(btw I figured out the whole object variable deal), Because GuiShapeNameHud executes like a while loop I basicly have a couter so after how ever many executions it's display until which creates a lot of problems. Though here you seem to know of a different way this can be acomplished? please tell ^_^
#11
09/10/2005 (11:35 pm)
Just a thought but wouldn't using a particleEmitter be a good way to go about this?

Just make number particles and throw them up from the eye node when the player's health
is reduced. I haven't actually tried this but it seems like it could work well.

Is it possible to create particle textures procedurally?