class Queen extends MovieClip { //variables var scrollSpeed:Number = 8; var i:Number = 0; var collision:Boolean = false; var n:Number = 0; var offWithHerHead:Sound; var scream:Sound; //functions function setQueenPosition () { this.attachMovie ('queen_mc','queen'+i,i); this['queen'+i]._x=275; this['queen'+i]._y=8500; i++; this.attachMovie ('queen_mc','queen'+i,i); this['queen'+i]._x=300; this['queen'+i]._y=9000; this['queen'+i].gotoAndPlay (15); i++; this.attachMovie ('queen_mc','queen'+i,i); this['queen'+i]._x=300; this['queen'+i]._y=9300; } function collisionTest () { //trace(collision); if (collision==false) { for (i=0;i<3;i++) { if (this['queen'+i].hitTest(_root.sprite.hit1x,_root.sprite.y1,true)) //top left hit { collision = true; if (_root.sprite.spin) { queenDies(); } else { offWithHerHead.start (); _root.sprite.topLeft (); _root.ground.lifeChange = 2; _root.ground.lifeHandler(); collision = false; } } else if (this['queen'+i].hitTest(_root.sprite.hit2x,_root.sprite.y1,true)) //top right hit { collision = true; if (_root.sprite.spin) { queenDies(); } else { offWithHerHead.start (); _root.sprite.topLeft (); _root.ground.lifeChange = 2; _root.ground.lifeHandler(); collision = false; } } else if (this['queen'+i].hitTest(_root.sprite.hit3x,_root.sprite.y2,true)) //center left hit { collision = true; if (_root.sprite.spin) { queenDies(); } else { offWithHerHead.start (); _root.sprite.topLeft (); _root.ground.lifeChange = 2; _root.ground.lifeHandler(); collision = false; } } else if (this['queen'+i].hitTest(_root.sprite.hit4x,_root.sprite.y2,true)) //center right hit { collision = true; if (_root.sprite.spin) { queenDies(); } else { offWithHerHead.start (); _root.sprite.topLeft (); _root.ground.lifeChange = 2; _root.ground.lifeHandler(); collision = false; } } else if (this['queen'+i].hitTest(_root.sprite.hit5x,_root.sprite.y3,true)) //bottom left hit { collision = true; if (_root.sprite.spin) { queenDies(); } else { offWithHerHead.start (); _root.sprite.topLeft (); _root.ground.lifeChange = 2; _root.ground.lifeHandler(); collision = false; } } else if (this['queen'+i].hitTest(_root.sprite.hit6x,_root.sprite.y3,true)) //bottom right hit { collision = true; if (_root.sprite.spin) { queenDies(); } else { offWithHerHead.start (); _root.sprite.topLeft (); _root.ground.lifeChange = 2; _root.ground.lifeHandler(); collision = false; } } } } } function queenDies () { scream.start(); for (n=0;n<200;n++) { this['queen'+i]._x=this['queen'+i]._x-n; this['queen'+i]._y=this['queen'+i]._y-n; collision = false; } } //handlers function onEnterFrame () { if (_root.ground.scrollStop == false) { this._y -= scrollSpeed; collisionTest (); } } //constructor function Queen() { setQueenPosition (); offWithHerHead = new Sound(); offWithHerHead.attachSound ('offWithHerHead'); scream = new Sound (); scream.attachSound ('scream'); } }