A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Can Somebody Tell Me If My AC2 Suddenly Glitched Out?

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

    Can Somebody Tell Me If My AC2 Suddenly Glitched Out?

    Why am I'm asking if my AC2 is glitched? First here is the code I'm using, I am following these video guides to a T (only changes are the character names).

    https://www.youtube.com/watch?v=F0CJ7ZJCjXE&index=58

    The AS:

    Son.onEnterFrame = function(){
    if(Shad.Shad Punch1.pad.hitTest(this) && !p2hit){
    this.gotoAndStop("Son Hit 1");
    } else if(!p2hit){
    this.gotoAndStop("Son Idle");
    }
    }
    And now, the error message:

    **Error** Scene=Scene 1, layer=actions, frame=21:Line 30: ')' expected
    if(Shad.Shad Punch1.pad.hitTest(this) && !p2hit){

    **Error** Scene=Scene 1, layer=actions, frame=21:Line 32: Unexpected '}' encountered
    } else if(!p2hit){

    Total ActionScript Errors: 2 Reported Errors: 2
    Note it says "')' expected" and "Unexpected '}'", also if I remove the } it then says "'else' encountered without matching 'if'"

    ....Isn't the errors it's telling me, are they even errors? Else does have the "if" and know the other one is wrong as well. It's not telling me "what" is wrong, but when I fix it I get 2 more errors and have to add them back. So what is doing on and why won't this work?

    If you need too, here's the script in full so far. I'm really puzzled as it really seems like the error message is backwards, telling me this is a error but it's not, it's suppose to be that way and when I try to fix it gives me more errors which "are" errors because the previous ones aren't even errors at all....are they?

    walkSpeed = 5;
    shadAttack = false;
    Shad.onEnterFrame = function() {
    if (Key.isDown(80) && !shadAttack && !jumping) {
    //P
    this.gotoAndStop("Shad Punch1");
    } else if (Key.isDown(75) && !shadAttack && !jumping) {
    //K
    this.gotoAndStop("Shad Kick1");
    } else if (Key.isDown(76) && !shadAttack && !jumping) {
    //L
    this.gotoAndStop("Shad Kick2");
    } else if (Key.isDown(Key.UP) && !jumping && !shadAttack) {
    this.gotoAndStop("Shad Jump");
    jumping = true;
    } else if (Key.isDown(Key.LEFT) && !jumping && !shadAttack) {
    Shad._xscale = -100;
    this._x -= walkSpeed;
    this.gotoAndStop("Shad Walk");
    } else if (Key.isDown(Key.RIGHT) && !jumping && !shadAttack) {
    Shad._xscale = 100;
    this._x += walkSpeed;
    this.gotoAndStop("Shad Walk");
    } else if (!shadAttack && !jumping) {
    this.gotoAndStop("Shad Idle");
    }
    };

    Son.onEnterFrame = function(){
    if(Shad.Shad Punch1.pad.hitTest(this) && !p2hit){
    this.gotoAndStop("Son Hit 1");
    } else if(!p2hit){
    this.gotoAndStop("Son Idle");
    }
    }

  2. #2
    Junior Member
    Join Date
    Aug 2015
    Posts
    26
    OK so I got this fixed, "Shad Punch1" having a space was causing the problem, why Idk AS2 can be so stupid and picky. But now I got a new problem, the code won't even work. Follow he video if you have too but the hit animation simply refuses to play.

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    so you misplaced a space character, but as2 is what's stupid? sounds like you are misplacing something else.
    who is this? a word of friendly advice: FFS stop using AS2

  4. #4
    Junior Member
    Join Date
    Aug 2015
    Posts
    26
    Quote Originally Posted by realMakc View Post
    so you misplaced a space character, but as2 is what's stupid? sounds like you are misplacing something else.
    It's stupid because it's too picky about how the code is suppose to be written, I managed to fix this problem btw but the video tuts are unfinished so---was a total waste of time..

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