import flash.events.Event; Mouse.hide(); //below is the code that we used in class, you need to add code that will output the angle for each enemy and draw the lines var xDiff, yDiff, radians, degrees:Number; stage.addEventListener(Event.ENTER_FRAME, aimPlanes); function aimPlanes(evt:Event) { graphics.clear(); fighterPlane.x = mouseX; fighterPlane.y = mouseY; xDiff = fighterPlane.x - enemy1.x; yDiff = fighterPlane.y - enemy1.y; radians = Math.atan2(yDiff, xDiff); degrees = radians * 180 / Math.PI; enemy1.rotation = degrees; showFighterAngle1(degrees); xDiff = fighterPlane.x - enemy2.x; yDiff = fighterPlane.y - enemy2.y; radians = Math.atan2(yDiff, xDiff); degrees = radians * 180 / Math.PI; enemy2.rotation = degrees; showFighterAngle2(degrees); xDiff = fighterPlane.x - enemy3.x; yDiff = fighterPlane.y - enemy3.y; radians = Math.atan2(yDiff, xDiff); degrees = radians * 180 / Math.PI; enemy3.rotation = degrees; showFighterAngle3(degrees); // Draws line from fighterPlane to enemyN graphics.lineStyle(2, 0x8899DD); graphics.moveTo(fighterPlane.x,fighterPlane.y); graphics.lineTo(enemy1.x,enemy1.y); graphics.moveTo(fighterPlane.x,fighterPlane.y); graphics.lineTo(enemy2.x,enemy2.y); graphics.moveTo(fighterPlane.x,fighterPlane.y); graphics.lineTo(enemy3.x,enemy3.y); } // Displays fighterPlane1 angle function showFighterAngle1(degrees:Number):void { enemy1Angle.text = String(Math.round(degrees)); } // Displays fighterPlane2 angle function showFighterAngle2(degrees:Number):void { enemy2Angle.text = String(Math.round(degrees)); } // Displays fighterPlane3 angle function showFighterAngle3(degrees:Number):void { enemy3Angle.text = String(Math.round(degrees)); }