PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Making hearth on a plataform game
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Making hearth on a plataform game

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

    Question Making hearth on a plataform game

    I'm doing a kind of plataform map, and now I need to make health (3 hearts, like Mario). I tried to do it with hittest but the hearts goes like crazy. Guess I need to make something like invulnerable or I don't know. What I want to do is three hearts, and, if the human touches a spike he loses a hearth.

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    Yeah, you need to use a hittest and then say something along these lines in your in your enterFrame function

    Actionscript Code:
    if(this.invincible)this.invincible--;
    if(this.hitTest(spike) && !this.invincible){
        this.health-=1;
        this.invincible=15;
    }

    Basically, it just has a variable called "invincible" that constantly counts down until it hits 0 (then it stays there until you set it to something else). It will only make you lose health if a collision is detected AND invincible==0. Then, once you lose 1 health, you set invincible to 15, so it won't trigger another hitTest for another 15 frames.

    I hope all that made sense.
    -Zippy Dee
    Ted Newman

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    12
    ["invincible" that constantly counts down until it hits 0]

    Ok, I understand your idea, but I have a new problem: how to make that count down (I already made a post for this, but got no answers). Ty!

  4. #4
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    in your enterFrame function, use:
    Actionscript Code:
    if(this.invincible)this.invincible--;

  5. #5
    Junior Member
    Join Date
    Nov 2009
    Posts
    12
    Ok, I don't know what's going on, I add the script but it's not working.
    I'm uploading the map so you can see it and maybe fix it. Thanks

    Edit: ups, forgot to upload

  6. #6
    Junior Member
    Join Date
    Nov 2009
    Posts
    12
    Uploading, sorry:

    Edit: aw this is a old version, but nvm, you still can fix it.
    Attached Files Attached Files
    Last edited by Neutronmax; 07-10-2010 at 08:35 AM.

Tags for this Thread

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