Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Health Bar (why won't it work?)

Author
Message
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 20th Jun 2004 11:29 Edited at: 20th Jun 2004 11:30
hi everyone!
i've been coding all day long, and i came across health in my game.
i've come to this, and it just doesn't work (i did change it so i didn't have to put in the enemy stuff and all that crap)



I've tried DEC and INC aswell, but that didn't work.
It's just not working!
Thanks to anyone who can help
Axelman

CURRENT PROJECT: Enemy At The Gates
Macrosii
21
Years of Service
User Offline
Joined: 31st Mar 2004
Location: Essex, UK
Posted: 20th Jun 2004 13:19
Not tried but something like

`health bar
`by Axel Williams(Axelman on the forums)
`hope this works!

`make box colour(Green)
fcolor = RGB(0,255,0)
INK fcolor,0

`Your Health
Health = 100

`Draw the health bar
BOX 1,5,Health,15
backdrop on
`Loop
do

`press down click to lower health
if downkey()=1 then Health=Health-0.1
`press right to lower health
if upkey()=1 then Health= Health + 0.1
if health < 0 then health = 0
if health > 100 then heaalth = 100

BOX 1,5,Health,15
loop
DeepBlue
22
Years of Service
User Offline
Joined: 17th May 2003
Location: A little box in the UK
Posted: 20th Jun 2004 13:31
Just beat me but hey heres another one



The coder formerly known as Twynklet.
FROGGIE!
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 20th Jun 2004 13:33
you need to put the part where you draw the health box in the main loop You will need to put a sync rate in to stop it flashing when you redraw it. Also the code is working but you need to clear the old health box before you draw the new one:



hope this helps

I should have changed my signature when asked
FROGGIE!
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 20th Jun 2004 13:34
wow 3 posts within 7 minutes

I should have changed my signature when asked
o0 Static 0o
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location: Belgium
Posted: 20th Jun 2004 13:37
The problem is that every time you perform the 'box' command you draw a new box.
And because the first box you draw is bigger than al the other boxes you dont see a differens.
Something like this.
1.)----------
2.)--------
If you first draw number 1 and then number 2 above number 1 then you woudend see i differens.

I hope this helps.
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 20th Jun 2004 13:39
Thanks everyone!
i've been playin around with it for ages but just couldn't get it to do what i wanted it to.
thanks again
Axelman
Cya!

CURRENT PROJECT: Enemy At The Gates

Login to post a reply

Server time is: 2025-05-26 04:58:14
Your offset time is: 2025-05-26 04:58:14