A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Advanced health bar help please!!

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    12

    Advanced health bar help please!!

    Hey guys what's up
    I am currently working on a project where the length of the Hero's Health Bar increases as it levels up
    How could this be achieved?

    Also what I'm really looking for is that the Health Bar circles around the Hero's portrait, a good example would be Sora from Kingdom Hearts

    Just two examples!!
    http://movies-music-games.com/wp-con...hearts_2_1.JPG
    http://jackcentral.com/wordpress_2.8...09/10/KH02.jpg

    mad respects to anyone willing to help me out!!
    any advice or tips would be greatly appreciated, thank you!!!!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Use code like this to draw arcs of the appropriate size, with a fill. I wouldn't use that class directly, but it does show you how to draw an arc of arbitrary size and position, which you can use in conjunction with beginFill to make your circularly filled bars.

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    12
    Hmm thanks I could try to incorporate that method somehow...I'm just really not sure how
    :P
    Could anyone suggest a different method, or explain the method above?
    Thanks!!!!!!!!

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The way I was thinking was that you would take that code and turn it into a drawArc method. You will then take your Sprite's Graphics object, and draw one large radius arc, a line to the inner arc, and the inner arc back, then a line connecting them.

    Do the same thing again, but with a shorter angular length and begin fill active to draw the filled portion of the health bar.

    Alternatively, you could pre-draw your empty bar, then just draw the line where the boundary is, then draw the whole thing into a Bitmap. Then use floodfill to fill the health area. You will display the final Bitmap, but keep the original vector drawing of the empty healthbar around to draw from again when the health changes.

  5. #5
    Junior Member
    Join Date
    Mar 2009
    Posts
    12
    alrite man thanks a lot i'll definitly take your responses into consideration
    youve been very helpful

    although i am still quite unsure on how to optimize this project, is there anyone else willing to help me out

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

HTML5 Development Center