A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [help] health bar code

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    [help] health bar code

    what is a simple code for a health bar... im not animating it i just want health to be 100 or what eva i choose...

    i think i will be right coding the enimies to take away health as i have seen lots of other people post some good stuff about it

    thank u

  2. #2
    Senior Member X-Tender's Avatar
    Join Date
    Jun 2003
    Location
    Germany
    Posts
    507
    Make a simple MovieClip Health Bar object.
    then you can use:

    at startup:
    _root.starthealth = 127;
    _root.health = _root.starthealth;

    makedamage = function(damage){
    _root.health -= damage;
    _root.healthbar._xscale = (_root.health/_root.starthealth)*100;
    }

  3. #3
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    thanx and aslo how do i make it say the number of health thats left???

  4. #4
    PlayerForever adi4x's Avatar
    Join Date
    Feb 2005
    Posts
    753


    _root.healthleft=_root.starthealth-_root.health
    Card Games - play many card games free
    Free Games many free online games

  5. #5
    Insignificant Member Joshman_123's Avatar
    Join Date
    Nov 2004
    Posts
    395
    Are "damage" and "start" actual functions in Flash or is that code supposed to be edited to suit the instance? Also, how would one make enemies take health off?
    I have like, a gazillion posts on my other account.

  6. #6
    PlayerForever adi4x's Avatar
    Join Date
    Feb 2005
    Posts
    753
    enemies take health off with hitTest
    Card Games - play many card games free
    Free Games many free online games

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