A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How do I make a Stinkin Health Pack?!?

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    31

    How do I make a Stinkin Health Pack?!?

    I have a health pack connected to a parachute and after 15 seconds it falls and the hero can pick it up and restore health. The parachute and health pack are inside the same clip and the following timer code is on the first frame inside the mc.
    Code:
    stop();
    	
    this._visible =false;
    function wait() {   
    this._visible = true;
    gotoAndPlay(2);
    
        clearInterval(myTimer);
    
    }
    myTimer = setInterval(wait, 15000);
    On frame 2, I have a tween of the parachute and healthpack slowly falling to the Earth. On the last frame I have this code:
    Code:
    stop();
    	
    if (this.hitTest(_root.character)) { gotoAndPlay(1); health +=1; }
    After 15 seconds, the clip becomes visible and it falls to the ground like normally. However my character gains health, but the clip does not go back to the first frame again. How can I make it so that when the character touches it, the health pack will disappear for another 15 seconds and the character will gain only 1 health.

  2. #2
    Senior Member
    Join Date
    Jan 2008
    Location
    Montreal
    Posts
    101
    Difficult to say just like this, can you post the fla?

  3. #3
    Member
    Join Date
    Aug 2006
    Location
    Philadelphia, PA
    Posts
    58
    Try adding this.gotoAndPlay(1) instead of just gotoAndPlay(1)

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