Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
damage above enemy #180093
01/27/08 05:36
01/27/08 05:36
Joined: Mar 2003
Posts: 60
wyldecatt Offline OP
Junior Member
wyldecatt  Offline OP
Junior Member

Joined: Mar 2003
Posts: 60
Could i get set in the right direction for writting a bit of code to display the damage done above an enemy. I knos this should be pretty common as it is done in most games but i couldnt seem to find a snipit for it or get my eggorts offf the ground
thanks

Re: damage above enemy [Re: wyldecatt] #180094
01/27/08 09:44
01/27/08 09:44
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
I will write some information how this can be done:

1. get the world coordinates of the entity (through a vertex above the head and vec_for_vertex or just the z-pos plus any value)

2. translate that position into screen coordinates with vec_to_screen

3.1 If you want a digit display: just show a text/panel at that position.

3.2 If you want a bar displaying how much HP the enemie has left you would need to subtract half of the bars width from the x-position you got in #2 and display the panel at that location


Hope this helps a bit

Re: damage above enemy [Re: Xarthor] #180095
01/30/08 01:00
01/30/08 01:00
Joined: Mar 2003
Posts: 60
wyldecatt Offline OP
Junior Member
wyldecatt  Offline OP
Junior Member

Joined: Mar 2003
Posts: 60
Ive given it a shot but cant seem to get it to work right. Ive decied to use the health var to display atm because my damage is computed from a random defence/atack varibles. I dont need a health above char i do already have a working health bar above my enemys here is what i have

PANEL health_pan =
{
bmap = health_map;
digits(0,0,4,health_fnt,10,health);
//flags = transparent,d3d,VISIBLE;
flags = VISIBLE;

}



function health_panel()
{
while(1)
{
vec_set(temp,my.x);
if (vec_to_screen(temp,camera)) // if visible on screen
{
health_pan.pos_x = temp.x; // place the flare panel
health_pan.pos_y = temp.y;
health_pan.visible = on;
} else
{
//health_pan.visible = off; // otherwise disable it
}
wait(1);
}
}

thanks in advance

Re: damage above enemy [Re: wyldecatt] #180096
01/30/08 01:02
01/30/08 01:02
Joined: Mar 2003
Posts: 60
wyldecatt Offline OP
Junior Member
wyldecatt  Offline OP
Junior Member

Joined: Mar 2003
Posts: 60
A note to the above post my function is called from the enemys action.
and its actually my.health in the function
i do get the panel to display at one of my enemys but it displays 0 for health

Re: damage above enemy [Re: wyldecatt] #180097
01/30/08 11:30
01/30/08 11:30
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Well the panel does not know what "my.health" is, or does it?
You need a global var (I think) which gets the current my.health value.
That global var can then be used in the panel.


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