A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: [F8] Health bar help

  1. #1
    Member
    Join Date
    Dec 2006
    Posts
    38

    [F8] Health bar help

    Ok. In my game, I have a bunch of randomly generated circles that fall and blow up when they hit a platform.
    I have that part down, but i wanted the circles to damage the platform so that every time a circle would fall on the platform it would bring the platform's health down.

    thanks and sorry if this is a stupid question.

  2. #2
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    Are these circles , removed when they hit the platform ?? Have you done this part ??

  3. #3
    Member
    Join Date
    Dec 2006
    Posts
    38
    yes, when they hit the platform the circles start playing the explosion part of thier timeline (which makes it look like the circles are exploding as they hit the platform) and then the MC is removed

  4. #4
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    ( Plz , first tell me where hitTest code is placed in frame or MC ...?? )

    Ok ... lets start. This code put on frame :

    onLoad = function(){
    var PlatformHealth:Number = 100;
    }

    And this code put where your hitTest function is :

    PlatformHealth -= 5;

    And if you want the health to show in textBox , create dynamic textBox and name it Health ... And put this code on frame:

    _root.Health.text = PlatformHealth;

    And at last if you want to make health bar , as you write in title , do this :

    Create an MovieClip and inside it draw the health bar you want ... Give the instance name HealthBar ... And use this code :

    _root.HealthBar._xscale = PlatformHealth;

    If you will have any problem , any question is welcomed

    I hope this all will help you

    .PumI.
    Last edited by pumi; 06-06-2007 at 06:18 PM.

  5. #5
    Member
    Join Date
    Dec 2006
    Posts
    38
    thanks so much ill try it

  6. #6
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    can you tell me where the hitTest is placed ... on MC or on frame ??

  7. #7
    Member
    Join Date
    Dec 2006
    Posts
    38
    hmm.. in the dynamic text box it just says undefined

  8. #8
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    Where is the hitTest function PLACED ????????

  9. #9
    Member
    Join Date
    Dec 2006
    Posts
    38
    the hittest is in the circle movieclip's timeline, on the second frame

  10. #10
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    can you post the file ... PLZ ??

  11. #11
    Member
    Join Date
    Dec 2006
    Posts
    38
    sorry but its too big, and its still to big when i try to compress it

  12. #12
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    try this code i gave to you

    onLoad = function(){
    var PlatformHealth:Number = 100;
    }

    change to

    var PlatformHealth:Number = 100;

  13. #13
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    and on hitTest function instead of:

    PlatformHealth -= 5;

    try

    _root.PlatformHealth -= 5;

  14. #14
    Member
    Join Date
    Dec 2006
    Posts
    38
    its still not working......and sorry for all this confusion

  15. #15
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274
    Your TextBox and :

    var PlatformHealth:Number = 100;

    And :

    onEnterFrame = function(){
    _root.Health.text = PlatformHealth;
    }

    are in main timeline and this :

    _root.PlatformHealth -= 5;

    is inside hitTest function , Right ??

    If it wont work ... try emailing the file to me , or uploading it here :

    http://www.creativededication.com

    using thir free hosting service ...

  16. #16
    Member
    Join Date
    Dec 2006
    Posts
    38
    let me get your E-Mail address and ill email it to you, because your email address is blocked when i click on your profile
    send me a private message if you dont wantpeople to see you address

  17. #17
    Banned
    Join Date
    Mar 2007
    Location
    Albania , prishtina
    Posts
    274

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