Now I need flash help.

Any flash game makers who can help me out?

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.

ANY help at all would be appreciated.

i noticed on your very first line you wrote KeyUp. is that supposed to be Key.Up like you have it everywhere else. by the way is this as2 or 3?

KeyUP just means that when no key is pressed. Saying that when no key is being pressed, the character will go to the “idle” frame so he does not move.

Key.UP is saying that when the Up arrow is pressed, move the character up.

I know i got that part right.

Its as2 btw.

ya that’s why i don’t recognize it. i only use as3. sorry, i’m no help there.

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?

It doesn’t, but when I take away one end bracket, and remove the bolded script (and its beginning bracket), it shows no errors.

was that the problem then?

Is this curly bracket backwards? if (Key.isDown(Key.UP)){

I don’t know anything specific to flash programming but you don’t have the same number of left and right curly brackets. Is that a concern?

it seems to me like the brackets are your problem. but i use as3 so if you have errors in your code i am no help there.

Is this some sort of nested routine like this? Then I think you have a bracket backwards near the bottom.

I tried to indent to show what I think it should be but it does not display in this forum window. I put some comments in your code below.

Am I getting close?

============================
onClipEvent(keyUp)
{
this.gotoAndStop(‘idle’);
}

onClipEvent (enterFrame)
{ ##### begin nest ######
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;
}

{ ##### end of nest but this bracket seems to be backwards

onClipEvent(Key.SHIFT)
{
this.gotoAndStop(‘shoot_up’);
}
} #### extra brackets
}

Use the

 tag (the # button in the advanced editor) to keep the indentation and tabs.

With indents… Thanks John.


onClipEvent(keyUp)
{
this.gotoAndStop('idle');
}

onClipEvent (enterFrame)
{ ##### begin nest ######
     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;
     }
{ ##### end of nest but this bracket seems to be backwards

onClipEvent(Key.SHIFT) 
{
this.gotoAndStop('shoot_up');
}
} #### extra brackets 
} 

I tried fixing what you pointed out, but that brought up more errors than I had :frowning: 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.