My Action Script 2 hitTest isn't working. I've tried searching for the answer, but found nothing. The hitTest isn't responding with the gotoAndStop I've assigned to it. Here is my code:
walkspeed = 25;
jumping = false;
scottjab = false;
crouching = false;
scottslash = false;
scott.onEnterFrame = function(){
if(Key.isDown(Key.DOWN) && !jumping && !scottjab && !crouching){
this.gotoAndStop("scottCrouch");
crouching = true;
} else if(Key.isDown(78) && !jumping && !scottjab && !crouching){
this.gotoAndStop("scottJab");
scottjab = true;
} else if(Key.isDown(77) && !jumping && !scottjab && !crouching){
this.gotoAndStop("scottSlash");
scottslash = true;
} else if(Key.isDown(Key.UP) && !jumping && !scottjab && !crouching){
this.gotoAndStop("scottJump");
jumping = true;
} else if(Key.isDown(Key.LEFT) && !jumping && !scottjab && !crouching){
this._x -= walkspeed;
this.gotoAndStop("scottWalk");
} else if(Key.isDown(Key.RIGHT) && !jumping && !scottjab && !crouching){
this._x += walkspeed;
this.gotoAndStop("scottWalk");
} else if(!jumping && !scottjab && !crouching){
this.gotoAndStop("scottIdle");
}
}
ilsa.onEnterFrame = function(){
if(scott.scottJab.pad.hitTest(this)){
this.gotoAndStop("ilsa Hit");
} else {
this.gotoAndStop("ilsa Idle");
}
}
The two characters ('scott' and 'ilsa') are also on different layers, if that helps. And there are 4 total scenes in the file.
I appreciate any help.
trace("hitTest");afterthis.gotoAndStop("ilsa Hit");in your ilsa.onEnterFrame function, what is the result (output)? - helloflashtrace(scott); trace(scott.scottJab); trace(scott.scottJab.pad);what happens? - helloflashoutsideof yourilsa.onEnterFrame function. What is the output? - helloflash