Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to display health above a player? #138557
06/28/07 11:01
06/28/07 11:01
Joined: Mar 2007
Posts: 27
P
PeterM Offline OP
Newbie
PeterM  Offline OP
Newbie
P

Joined: Mar 2007
Posts: 27
How can i display players health or damage above his head?

i mean like this:


this image shows damage that has been done to the monster...

Re: How to display health above a player? [Re: PeterM] #138558
06/28/07 11:43
06/28/07 11:43
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Try something like this: (not tested)
while(1)
{
vec_set(temp,monster.pos);
vec_to_screen(temp,camera);
panel.pos_x = temp.x - (panel.size_x /2); //to be at center
panel.pos_y = temp.y - 50; //play with this value to place panel above entity
wait(1);
}

Last edited by tompo; 06/28/07 11:44.

Never say never.
Re: How to display health above a player? [Re: tompo] #138559
06/28/07 13:40
06/28/07 13:40
Joined: Mar 2007
Posts: 27
P
PeterM Offline OP
Newbie
PeterM  Offline OP
Newbie
P

Joined: Mar 2007
Posts: 27
not exactly what i wanted but tnx anyway it works nice.

New question.
how can i copy my pannel?
i drew a picture so i can explain easier what i want.



screen has ICON 1, ICON 2 and so on.
now i want that this icons are icon_enemy panels.
So when I click on icon 1 or icon 2 I call SUM_ENEMY();


I hope you understand what i mean

Thank you.

Re: How to display health above a player? [Re: PeterM] #138560
06/28/07 14:37
06/28/07 14:37
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
For your 2nd question, you can write the code like this :

Code:

panel icon1
{
pos_x = 5;
pos_y = 10;
bmap = enemyBmap;
on_click = sum_enenmy;
}




I don't understand what you mean "copy panel", maybe you can write
your code like this :

PANEL* icon2;

panel icon1
{
//... define elements of icon1
}

icon2 = icon1;

EDIT
----
I've modified some codes.



Last edited by vlau; 06/28/07 14:54.
Re: How to display health above a player? [Re: vlau] #138561
06/28/07 17:51
06/28/07 17:51
Joined: Mar 2007
Posts: 27
P
PeterM Offline OP
Newbie
PeterM  Offline OP
Newbie
P

Joined: Mar 2007
Posts: 27
yes thats what i mean but it doesnt work.
This is what I did...
Code:
 

PANEL* icon1;
PANEL* icon2;

panel icon_enemy
{
bmap=i_enemy;
pos_x=10;
pos_y=10;
layer=11;
on_click=summon_enemy;
flags = overlay, refresh;

}




then I copyed icon_enemy panel in icon1 and 2 like this.
Code:
  

if (i==0)
{
icon1=icon_enemy;

icon1.pos_x=main_slot2_pan.pos_x+16;
icon1.pos_y=main_slot2_pan.pos_y+17;
icon1.visible=on;
icons[i]=1;
}

if (i==1)
{
icon2=icon_enemy;

icon2.pos_x=main_slot3_pan.pos_x+16;
icon2.pos_y=main_slot3_pan.pos_y+17;
icon2.visible=on;
icons[i]=1;
}




So now first i=0 so it copys panel to icon1 and sets icon1 position.
Then i=1 and copys panel to icon2 and sets icon2 position and suddenly
icon1 dissaperes. which i dont want i want both icon1 and icon2
to be visible, and when i click on them they both have to call the same function.

Tnx for your help.

Re: How to display health above a player? [Re: PeterM] #138562
06/28/07 18:35
06/28/07 18:35
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
You want to have panel over each entity? or what?
if yes... not easyer is do this by pan_create in every entity's action?


Never say never.
Re: How to display health above a player? [Re: PeterM] #138563
06/28/07 18:38
06/28/07 18:38
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline
Member
dennis  Offline
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
Hi PeterM!

For positioning the health above the player you can also use the position near the head of tht player instead of his origin...

(Using vec_for_vertex)

You will probably have to subtract a bit, too. However it will be more accurate.

Re: How to display health above a player? [Re: dennis] #138564
06/28/07 19:05
06/28/07 19:05
Joined: Mar 2007
Posts: 27
P
PeterM Offline OP
Newbie
PeterM  Offline OP
Newbie
P

Joined: Mar 2007
Posts: 27
tompo yes i was thinking of something like that but pan_create
takes only bmap and layer like in example:

Splash = pan_create("bmap = splash.pcx;",1);

but i want the panel to have an on_click option to.

Oh never mind i just figured it out that i can do this...
icon1=pan_create("bmap=i_enemy; on_click=summon_enemy;",11);

tnx for your help tompo

Last edited by PeterM; 06/28/07 19:12.

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

Gamestudio download | chip programmers | 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