import PippoFlash.*; var bulletCounter = 1; var down = Stage.height; var shootLeft = true; var initY = gun1._y; function onMouseDown() :Void { // Shoot the bullet var shootGun = shootLeft ? gun1 : gun2; var bull = attachMovie("bullet", "bullet"+bulletCounter++, bulletCounter); bull._xscale = 100 - (_ymouse / 4); bull._x = shootGun._x; bull._y = shootGun._y; bull._rotation = TrigCalc.getRelAng(shootGun._x, shootGun._y, _xmouse, _ymouse); SmoothMover.slide(bull, {speed:6,props:["_x","_y","_xscale","_yscale"],endPos:[_xmouse,_ymouse,2,2],listener:_root}); // Move the turret // shootGun._y = initY + 30; // SmoothMover.slide(shootGun, {speed:3,props:["_y"],endPos:[initY]}); shootGun.gotoAndPlay(2); // Change shooting side shootLeft = !shootLeft; } function onMouseMove() :Void { pointer._x = _xmouse; pointer._y = _ymouse; gun1._rotation = TrigCalc.getRelAng(gun1._x,gun1._y,_xmouse,_ymouse); gun1._xscale = 100 - (_ymouse / 6); gun2._rotation = TrigCalc.getRelAng(gun2._x,gun2._y,_xmouse,_ymouse); gun2._xscale = 100 - (_ymouse / 6); } function onSmoothMoverFeedback(o) :Void { if (o.message == "SMCOMPLETE") { makeExplosion(o.clip._x,o.clip._y); o.clip.removeMovieClip(); } } function makeExplosion(x,y) :Void { var xp = attachMovie("expl", "expl"+bulletCounter++, bulletCounter); xp._xscale = xp._yscale = 1; xp._x = x; xp._y = y; SmoothMover.slide(xp, {speed:5,props:["_xscale","_yscale","_alpha"],endPos:[300,300,0],kill:true}); } Mouse.hide();