Results 1 to 2 of 2

Thread: Vertical Health recharging.

Threaded View

  1. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Vertical Health recharging.

    Basically to do this you (based off my Bosskillers game you'll see in my signature) you'll need a simple formula:

    Health Recharging = (Time / Total Time To Recharge In Seconds) * Length Of Health Bar In Pixels

    Or another way of doing it for just health in general:

    Health = (Current Health / Total Health) * Length Of Health Bar In Pixels

    This can be any direction you choose. Left to Right, Right to Left, Top To Bottom, Bottom To Top, or even circular if you choose. Its all a matter of playing with the values. Lets make a rectangle where top left is 0, top right is 1, bottom left is 2 and bottom right is one. To go from top to bottom you would need this:

    vb Code:
    1. With Health_Bar
    2.         If Player.Stats.Total_Health <> 0 Then HP = (Player.Stats.Current_Health / Player.Stats.Total_Health) * .Frame_Size.Bottom
    3.    
    4.         .Vertex_List(0) = Create_TLVertex(.X + .Frame_Size.Left, .Y + .Frame_Size.Top, 0, 1, D3DColorRGBA(255, 255, 255, 255), 0, 0, 0)
    5.         .Vertex_List(1) = Create_TLVertex(.X + .Frame_Size.Right, .Y + .Frame_Size.Top, 0, 1, D3DColorRGBA(255, 255, 255, 255), 0, 1, 0)
    6.         .Vertex_List(2) = Create_TLVertex(.X + .Frame_Size.Left, .Y + HR, 0, 1, D3DColorRGBA(255, 255, 255, 255), 0, 0, 1)
    7.         .Vertex_List(3) = Create_TLVertex(.X + .Frame_Size.Right, .Y + HR, 0, 1, D3DColorRGBA(255, 255, 255, 255), 0, 1, 1)
    8. End With

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width