Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
HealthBar #137221
06/20/07 13:03
06/20/07 13:03
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Hi there programmer's.

Im trying to figure out how to make a healthbar >.<
For many of you it will be maybe simple but im having a hard time on it.

i know that i must make a panel on the desired place.
I allready have that with a transparant bar in it.

That is easy for me to do with panels

But then the panel for the bar itself that is placed under the healthpanel
How can i shrink it depending on the players health ?

I made a skill for the health with a value
And know that i must do something like that the full picture = 100% and the hp also is 100 then when a value of for example 14 is subtracted then then 100% goes 100-14= 86% of the bar.

But how can i make a panel shrink like that ? :S
Someone can get me on the right path and give me some advice ?

Thanks in advance


-The Dragon's Eye is alway's watching you!-
Re: HealthBar [Re: SurudoiRyu] #137222
06/21/07 08:08
06/21/07 08:08
Joined: Apr 2007
Posts: 582
Germany
Poison Offline
User
Poison  Offline
User

Joined: Apr 2007
Posts: 582
Germany
make a window at the panel


Everything is possible, just Do it!
Re: HealthBar [Re: Poison] #137223
06/21/07 08:47
06/21/07 08:47
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Quote:

make a window at the panel




How you mean make a window ? never heard of that :S

Can you explain a bit more plz ?


-The Dragon's Eye is alway's watching you!-
Re: HealthBar [Re: SurudoiRyu] #137224
06/21/07 09:13
06/21/07 09:13
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
you need panel with window
Point is that window shows only a part of the bmap.
(example bmap)

Code:
 
bmap your_bmap = "some.bmp"; //it could be some frame with black inside but not necessary
bmap health_bar = "health.bmp"; //bmap with width f.e. 200 where only half of bmap is till with some color rest is black, height of this image is f.e. 10
var my_live;
panel show_health
{
bmap = your_bmap;
window 0,0,100,10,health_bar,my_live,null; //read help
flags refresh, overlay;
}



then you may convert your live to % like:
Code:
 
my_live = (my.live * 100) /my_max_live;
my_live = 100 - my_live;



always 100 pixels of the bmap will be shown, but starting point will be change.
It means if you have 100% live then my_live = 0; it means that bmap will be shown from 0 to 100 of his width (bar will be full).


But if you'll have 60% of my.live then 100-60=40 so window will show your bar from 40 to 140 pixels so you'll see only part of color bar and rest will be invisible because rest is tilled with black color.


It's easyer to do than to explain in english Read help


Last edited by tompo; 06/21/07 10:19.

Never say never.
Re: HealthBar [Re: tompo] #137225
06/21/07 19:08
06/21/07 19:08
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Why do you dont use panel.scale_x or panel.scale_y

so you have to make it like this:

health_bar.scale_y=player_health/100;

or similar. (Don't forget to insert this in a loop)

Regards
TSGames

Re: HealthBar [Re: TSG_Torsten] #137226
06/21/07 19:16
06/21/07 19:16
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
@TSGames:
interesting idea, but using that approach its hard to realize a healthbar which fades from color A to color B and so on
Simple healthbars with one color could be realized that way.

The window element of the panel is the right way to go in this case I think.

Re: HealthBar [Re: Xarthor] #137227
06/26/07 09:23
06/26/07 09:23
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Sorry for late reply (had some problem's >.<)
Ill try your thing tompo it seems indeed very easy you explained it awesome
And i know what you mean with it. just a 10 for explaining ^-^ thanks
Ill try to figure it out when i get home
Ill try to make some screenshots and post them here when im done with it maybe i can't get it working or something i need help with it.

TSGames thanks for your reply also.

At the moment im making a bar with red that fades slowly to a black bar

Greetzzzz,


-The Dragon's Eye is alway's watching you!-
Re: HealthBar [Re: SurudoiRyu] #137228
06/26/07 14:04
06/26/07 14:04
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
got one question
I got a healthbar but the background must be transparant,
Do i need to make also a transparant picture ? or must i leave it blank or something like that ?

(here is my picture)

"The white background is transparant in the game version"

I got now 1 picture not 2 cause the health disappear's and doesn't go to another color.
so that would give me a transparant picture ? or just nothing ?

Greetzzz,


-The Dragon's Eye is alway's watching you!-
Re: HealthBar [Re: SurudoiRyu] #137229
06/26/07 14:12
06/26/07 14:12
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
- if U use one color U may do it with panel.scale_y (if vertical)
- second half should be black or with alpha channel to be transparent
(look at my bar picutre above)
Cheers

EDIT:
Your bmap should look like this:


Last edited by tompo; 06/26/07 14:16.

Never say never.
Re: HealthBar [Re: tompo] #137230
06/27/07 07:25
06/27/07 07:25
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Ok cool thanks ^-^ it work's
Awesome ^-^

Cheer's Tompo


-The Dragon's Eye is alway's watching you!-

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