; Image Life Bar Function by Eikon Graphics 640, 480, 16, 2 SetBuffer BackBuffer() Global iPer = 0 ; Image Percent Marker Global Bar = LoadImage("bar.png") ; Image to use for Health Bar Global iWidth = ImageWidth(Bar) ; Image Information Global iHeight = ImageHeight(Bar) Global Dir = 1 ; 1 = Left to Right / 2 = Right to Left Global Speed = 2 ; Bar Speed While Not KeyDown(1) LifeBar(50, 50, iPer) iPer = iPer + Speed Flip: Cls Wend: End Function LifeBar(X, Y, Per) If Dir = 1 Then ; Left to Right For i = 0 To iWidth - Per CopyRect i, 0, 1, iHeight, X+i, Y, ImageBuffer(Bar), BackBuffer() Next If iPer >= iWidth Then iPer = 0 ; Restart ElseIf Dir = 2 Then ; Right to Left For i = iWidth To 0 + Per Step - 1 CopyRect i, 0, 1, iHeight, X+i, Y, ImageBuffer(Bar), BackBuffer() Next If iPer >= iWidth Then iPer = 0 ; Restart EndIf End Function