A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [CS3] Energy Bar

  1. #1
    Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    69

    Cow Icon [CS3] Energy Bar

    i am trying to create an energy bar that regenerates back to 100% slowly over time and is used up slowly when a 'player' moves or jumps wiht the arrow keys, also if it gets to 0 its goes to frame , gotoandplay...
    im using as2

    any kind of help would be great or tuts or posts

    thanks funky

  2. #2
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    You can place in the player movement something like:
    if (Key.isDown(Key.RIGHT)) {
    _x += 5;
    _root.health -= 0.25;
    } else if (.... etc, etc, same with the other keys
    } else {
    _root.health += 0.5;
    }
    if (_root.health == 0) {
    _root.gotoAndPlay(x);
    }
    Then you should make a movieClip that adjust it's _yscale or _xscale to the value of health, something like this._xscale = _root.health. Of course it's something very quick I'm doing just to give you an idea, but hope it helps.
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

  3. #3
    Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    69
    Quote Originally Posted by PhobiK
    You can place in the player movement something like:
    if (Key.isDown(Key.RIGHT)) {
    _x += 5;
    _root.health -= 0.25;
    } else if (.... etc, etc, same with the other keys
    } else {
    _root.health += 0.5;
    }
    if (_root.health == 0) {
    _root.gotoAndPlay(x);
    }
    Then you should make a movieClip that adjust it's _yscale or _xscale to the value of health, something like this._xscale = _root.health. Of course it's something very quick I'm doing just to give you an idea, but hope it helps.
    ok yea thanks that has helped me out a lot!

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