1 registered members (AndrewAMD),
14,661
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to create digits above units head? //SOLVED!
#327974
06/09/10 16:52
06/09/10 16:52
|
Joined: May 2010
Posts: 23 Germany
h34dl4g
OP
Newbie
|
OP
Newbie
Joined: May 2010
Posts: 23
Germany
|
As the title description says, I need to know how I can create digits above a specific units head. I tried to change the x and y coordinate with something like "my.pos_x or player.pos_x" and so on, but I really don't have a clue how I can define the top of the unit. My code:
player_life = 100
...
PANEL* player_life_pan =
{
pos_x = player.pos_x; <<< Not working
pos_y = player.pos_y; <<< Not working
digits(10, 10, 5, "Arial#50b", 1, player_life;
}
Any help is highly appreciated
Last edited by h34dl4g; 06/09/10 17:37.
1338, beyond leet.
|
|
|
Re: How to create digits above units head?
[Re: h34dl4g]
#327976
06/09/10 17:01
06/09/10 17:01
|
Joined: May 2007
Posts: 2,043 Germany
Lukas
 
Programmer
|
 
Programmer
Joined: May 2007
Posts: 2,043
Germany
|
|
|
|
Re: How to create digits above units head?
[Re: Lukas]
#327979
06/09/10 17:06
06/09/10 17:06
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
You are looking for vec_to_screen:
vec_set(temp,vector(player.x,player.y,player.z+player.max_z+30)); if(vec_to_screen(temp,camera)) { set(player_life_pan,VISIBLE); player_life_pan.pos_x = temp.x; player_life_pan.pos_y = temp.y; } else { reset(player_life_pan,VISIBLE); }
Then the digits element should have position values close to zero: digits(-30, 0, 5, "Arial#50b", 1, player_life);
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: How to create digits above units head?
[Re: Superku]
#327980
06/09/10 17:22
06/09/10 17:22
|
Joined: May 2010
Posts: 23 Germany
h34dl4g
OP
Newbie
|
OP
Newbie
Joined: May 2010
Posts: 23
Germany
|
Thanks for all your help, it works perfectly with just a bit coordinate tweaking. I really have to use more Vectors...still got problems with them.
//SOLVED
1338, beyond leet.
|
|
|
|