Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (AndrewAMD), 14,661 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Newbie
h34dl4g  Offline 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:
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 Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany

Re: How to create digits above units head? [Re: Lukas] #327977
06/09/10 17:05
06/09/10 17:05
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey


3333333333
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 Offline
Senior Expert
Superku  Offline
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 Offline OP
Newbie
h34dl4g  Offline 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.
Re: How to create digits above units head? [Re: h34dl4g] #327981
06/09/10 17:38
06/09/10 17:38
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Quote:

@lukas unrelated?

Yeah, sorry, I didn't read h34dl4g's psot carefully enough, so I thought he wanted to put the digits above other 2D elements. grin


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1