So for school the assignment is to make a game with AS2 in Flash CS5.5. What I'm going for is a sort of avoider game where enemies scroll up from the bottom of the screen and the player avoids them. I have the enemies scrolling up and resetting at a random position at the bottom of the screen again, but when the player hits an enemy the enemies keep scrolling and restting. I'm not very used to AS or coding in general, but I tried adapting various tutorial codes for this to work, but to no avail yet. I hope you guys can make sense of all this.


The code on the enemy mc is as follows:


Code:
onClipEvent (load) {

 function reset(){
	this._y=400;
	this._x=random(550);
	enemySpeed=random(4)+3;
 }
 function reset2(){
	this._y=500;
	this._x=random(550)+550;
	enemySpeed=0;
	this._alpha=0;
 }
 reset();
 var taart:Boolean = false
 
 }


onClipEvent (enterFrame) {

 if (_root.spaceship.scrollStart){
	this._y-=enemySpeed+_root.mainGround.groundSpeed;
 } else {
	this._y-=enemySpeed;
 }


 if (this._y<-10) {
	 _root.score+=100;
	reset();
 }
 
 if (taart==true) {
	reset2();
}

 if (this.hitTest( _root.spaceship ) ){
	 taart = true;
	_root.gotoAndPlay (2);
	
}


}
On the frame there is the following script:

Code:
stop();

numEnemy=3;

for (i=2; i<=numEnemy; i++){
	enemy1.duplicateMovieClip( "enemy"+i, i+100 );
	
}

score=0;