Hi i have some code for a health/exp bar, i've tried it loads of ways but it doesn't work when adding the equation.
Tried this way
global CurExp = 0
global NextExp = 250
global expProgress = 492
do
healthbar1()
loop
function healthbar1()
box 492, 5, 642, 20, rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0)
box 492, 5, expProgress, 20, rgb(0,255,0), rgb(0,255,0), rgb(0,255,0), rgb(0,255,0)
if expProgress < 492
expProgress = 492
endif
endfunction
function cookPizza()
printScreen()
print "Cooking a Pizza"
Pizzas = Pizzas - 1
Time = 6000
do
if Time > 0
Time = Time - 1
else
print "Cooked a Pizza"
addExp(5)
Cash = Cash + 5
printScreen()
exitfunction
endif
loop
endfunction
function addExp(ExpAdd)
CurExp = CurExp + ExpAdd //Exp + ExpAdd
newExp = 150 / NextExp * ExpAdd
expProgress = expProgress + newExp
if CurExp >= NextExp //If current exp is higher than Exp for next level
CurExp = NextExp //Fix up over-mating the Next-Exp before change
NextExp = NextExp * 2 //Next Level Exp Doubles
Level = Level + 1
CashGain = CurExp / 3
print "Lvl up! $"; CashGain; " Gained!"
Cash = Cash + CashGain
endif
print "You gained "; ExpAdd; " Exp!"
sleep 2500
printScreen()
endfunction
Tried with this line changed
expProgress = expProgress + (150 / NextExp * ExpAdd)
But it works on a calculator and adds up to 3 but in our program when we just try + 3 instead of the sum, It works.
but this way won't or does'nt seem to add anything.
Basicaly it's taking 492 + (150 / 250 * 5) which should be 495,
Thanks for any help...
FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU