
-----------------------------------
Foxhunter
Tue May 04, 2010 9:13 am

Assistance - Health Bar for RPG styled game?
-----------------------------------
What is it you are trying to achieve?
We are trying to achieve a healthbar for our RPG styled game. WHenever you click 'Attack' we want the opponents 'Health bar' to go down.


What is the problem you are having?
We can't seem to create one. 


Describe what you have tried to solve this problem
We attempted to create a green fillbox that had the 'x' values assigned to 'health' so when x is equal to zero, the x values would as well and the box wouldn
t exist anymore. 


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

N/A



import GUI
setscreen ("graphics:700;725")
var Saphiron := Pic.FileNew ("Saphiron.jpg")
var Health : int
var Damage : int
var count : int
var pHealth : int
var mDamage : int
Health := 100
pHealth := 100
process Playmusic
    Music.PlayFile ("Doom 2 Shawn's got the shotgun.wav")
end Playmusic

fork Playmusic

procedure mAttack
    put "Saphiron deals, ", mDamage, " to you!"
    pHealth := pHealth - mDamage
    put "Your Health is, ", pHealth,"!"
end mAttack

procedure attack
    locate (1, 1)
    put "You have dealt ", Damage, " to Saphiron!"
    delay (10)
    Health := Health - Damage
    put "Saphiron's health is, ", Health, "!"
end attack

Pic.Draw (Saphiron, 150, 70, picMerge)
 var Attack : int := GUI.CreateButton (20, 10, 30, "Attack", attack)

loop
    Damage := Rand.Int (3, 12)
    mDamage := Rand.Int (2 ,7) 
    GUI.SetColor (Attack, brightred)
    delay (50)
    mAttack
    if Health 