Heres my code, and the boldface is where it brings me for the problem:
onClipEvent(keyUp){
this.gotoAndStop(‘idle’);
}
onClipEvent (enterFrame){
if (Key.isDown(Key.UP)){
this._y-=6;
this.gotoAndStop(‘hero_up’);}
if (Key.isDown(Key.DOWN)){
this._y+=6;
this.gotoAndStop(‘hero_down’);}
if (Key.isDown(Key.LEFT)){
this._x-=6;
this.gotoAndStop(‘hero_side_left’);}
if (Key.isDown(Key.RIGHT)){
this._x+=6;
this.gotoAndStop(‘hero_side_right’);
}
if (_root.walls1.hitTest(_x, getBounds(_root).yMin, true)) {
this._y+=6;
}
if (_root.walls1.hitTest(_x, getBounds(_root).yMax, true)) {
this._y-=6;
}
if (_root.walls1.hitTest(getBounds(_root).xMin, _y, true)) {
this._x+=6;
}
if (_root.walls1.hitTest(getBounds(_root).xMax, _y, true)) {
this._x-=6;
} {
onClipEvent(Key.SHIFT) {
this.gotoAndStop(‘shoot_up’);
}
}
}
I have an error, taking me here when I click “go to source”. It tells me that onClipEvent handlers may not nest inside of other onClipEvent handlers. What does this mean? Any help would be appreciated. I want to make it so that when you hold shift, it plays the characters shooting position.
The rest of the code expresses him playing a walk animation when I press the arrow keys, and him moving in the direction of the arrow key being pressed.
I’ve never coded in Flash, but it looks like you may not have closed the last onClipEvent before the one giving the error… You’ve got a lot of brackets there. Does your IDE show which open bracket a closing bracket is matched with?
I tried fixing what you pointed out, but that brought up more errors than I had I’ll ask some tutorial guy for help, and get back when i realize the problem.
I did have one extra bracket though, so thank you for that.