dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Working With A Damage Script In AS2

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2015
    Posts
    26

    Working With A Damage Script In AS2

    http://www.mediafire.com/download/ti...+Game+Test.fla

    Yeah me again, hopefully this'll be the last thing I need help with for a while. I been trying to get this script to work,

    onClipEvent (enterFrame) {
    if (_root.Son.hitTest(this) && _root.VcamGame.ringCounter>=0) {
    _root.Son.gotoAndStop("SonHit");
    _root.VcamGame.ringCounter = 0;
    } else if (_root.Son.hitTest(this) && _root.VcamGame.ringCounter<=0) {
    _root.alive = false;
    }
    }
    let me explain what I need. The bottom half under "else if" that works, when the character gets hit with 0 rings he dies. But even WITH rings he still dies and the script perfectly says if ringCounter >=0 then he "shouldn't die", so why does he keep dying when the scripts tells flash "not to play the death animation"?

    I hate having to link the fla, but it would be better than explaining. The ringCounter is inside the Vcam which I named "VcamGame" and inside the little bug guy on his frame 2, that's where the yellow bullet that damages Sonic is located. I added

    Let me know if any of you knows what I'm doing wrong, he shouldn't be dying but nothing I do is fixing this.

  2. #2
    Senior Member
    Join Date
    Aug 2012
    Posts
    124
    maybe you just try using else if (_root.Son.hitTest(this) && _root.VcamGame.ringCounter< 0)
    less than zero as you get mixed with saying ]

    greater than or equal to 0

    with

    less than or equal to 0


    both statements have an equal to 0

    confuse code

  3. #3
    Junior Member
    Join Date
    Aug 2015
    Posts
    26
    Quote Originally Posted by Terrencing View Post
    maybe you just try using else if (_root.Son.hitTest(this) && _root.VcamGame.ringCounter< 0)
    less than zero as you get mixed with saying ]

    greater than or equal to 0

    with

    less than or equal to 0


    both statements have an equal to 0

    confuse code
    Nope, that just made the ring count unaffected when hit and he still dies.

  4. #4
    Junior Member
    Join Date
    Aug 2015
    Posts
    26
    OK I got it halfway fixed. I had to remove something from the main script for the character (something the tut SAID TO ADD and as the guy never finishes his tuts...) and the damaging animation plays.

    However, the animation is frozen on frame 1 and returns to idle a few secs later. Any idea why the animation is a still frame all of a sudden?

  5. #5
    Junior Member
    Join Date
    Aug 2015
    Posts
    26
    I hope double posting won't get me in trouble, but I realize the trouble. If you look into the fla you'll see the yellow bullet has a script that deals the damage to Sonic, and it seems to have a very wide reach to it and thus, flash is reading it as always hitting Sonic so his hit frame (and the sound attached) is unable to even play.

    How can I fix this?

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