Page 1 of 1

I need help with my HP bar

Posted: Sat Jul 23, 2016 6:11 am
by Albert
So I tried to make an HP bar. If I try to update it I must use CLS but I don't want the whole screeen to get cleared.
Is there any way to fix this or clear only a part of the screen?

Code: Select all

SCREEN _NEWIMAGE(800, 600, 32)

white& = _RGB(255, 255, 255)
green& = _RGB(0, 255, 0)

fhp = 100
hp = fhp

DO
    REM Health Bar
    'outter line
    ol_x = 797 - fhp
    LINE (ol_x, 0)-(799, 17), white&, B
    'hp
    hp_x = ol_x + 1
    hp_x1 = hp_x + hp
    LINE (hp_x, 1)-(hp_x1, 16), green&, BF
    _DELAY 1
    hp = hp - 10
    CLS
LOOP UNTIL INKEY$ = CHR$(27) OR hp = 0

Re: I need help with my HP bar

Posted: Sat Jul 23, 2016 1:34 pm
by burger2227
Place a black box over the green end area and work it back to the start.
You can replace the white frame each loop or place the green box inside of it instead.

Re: I need help with my HP bar

Posted: Sun Aug 21, 2016 2:32 pm
by Albert
burger2227 wrote:Place a black box over the green end area and work it back to the start.
You can replace the white frame each loop or place the green box inside of it instead.
sorry because it took me so long to answer but thank you so much!!!