class Invader extends MovieClip { //variables var moveDelay:Number; var xmov:Number = 10; var i:Number; var bulletHit:Boolean = false; var launcherHit:Boolean = false; var score:Number = 0; var alienExplode:Sound; //functions function rePlace () { bulletHit = false; launcherHit = false; this._y = (Math.floor (Math.random()*350) +20); this._x = (Math.floor(Math.random()*150)+580); } //handlers function onEnterFrame () { trace (launcherHit); this._x -= xmov; if (this._x < -10) { rePlace (); } if ((this.hitTest (_root.bullet)) && bulletHit == false) { alienExplode.start (); launcherHit=true; bulletHit = true; this.gotoAndPlay ('explode'); _root.launcher.bulletNo = false; _root.launcher.bulletCounter--; _root.launcher.score += 100; _root.bullet.removeMovieClip(); } } function resetGame () { _root.score.score = 0; } //constructor function Invader () { alienExplode = new Sound (); alienExplode.attachSound('alienExplode'); rePlace (); } }