←  Games Development

Fallout Studios Forums

»

Requiring assistance in Flash AS3

AZZKIKR's Photo AZZKIKR 04 Feb 2010

Hi. I am doing a tank game in flash, and I am having problems, namely in the rotating of turret.

Quote

turret.addEventListener(Event.ENTER_FRAME, rotateTurret);

function rotateTurret(event:Event):void {

angle = Math.atan2(mouseY-Be_mc.y, mouseX-Be_mc.x);

angle *= radiansToDegrees;

Be_mc.rotation =(angle*–1) +90;
}
}


i have a syntax error. can anybody help?
Quote

Dauth's Photo Dauth 04 Feb 2010

For a start you have an extra bracket at the end of the program.

Remove one of the } from it.
Quote

AZZKIKR's Photo AZZKIKR 04 Feb 2010

well, i got another problem. managed to solve this part though.

Quote

addEventListener(Event.ENTER_FRAME, scrolling);
function scrolling (event: Event){
if (floor.Be_MC.x < 10) {
floor.x += 10;
} else if (floor.Be_MC.x > stage.stageWidth - 10){
floor.x -= 10;
}
}


when my tank moves to the side, the BG scrolls, and does not stop
Quote