I'm trying to create a cannon firing game in which you shoot down planes. I found an error that I cant fix.
1084: Syntax error: expecting rightbrace before not.
Here is my script.
import fl.controls.Button;
//this listens for a key press and executes the function "pivot"
stage.addEventListener(KeyboardEvent.KEY_DOWN, pivot);
//this defines the function "pivot"
function pivot(event:KeyboardEvent):void
{
//test to see what key is pressed AND whether cannon is upright
if (event.keyCode==39 && cannonbarrel_mc.rotation<90){
//rotate cannon 1 degree right
cannonbarrel_mc.rotation +=1;
}
else if (event.keyCode==37 && cannonbarrel_mc.rotation> -90){
//rotate cannon 1 degree left
cannonbarrel_mc.rotation -=1;
}
var cannonballSpeed=9;
var cannonballReady=true;
var cannonballDelay=150;
var cannonballArray=[];
var cannonballCount=0;
function createcannonballs():void{
var ball= this.attachMovie("cannonball"+cannonballCount, 1000+cannonballCount);
cannonballCount++;
ball.DisplayObject.x=cannonbarrel_mc.DisplayObject.x+(cannonbarrel_mc.DisplayObject.width/2);
ball.DisplayObject.y=cannonbarrel_mc.DisplayObject.y+ball._height;
cannonballArray.push(ball);
}
fire!.addEventListener(MouseEvent.CLICK, createcannonballs);
}
PLZ help me THX