Ok i have this code on an enemy on the frame
onClipEvent(enterFrame){
if(this.HP > 0){
dead = false
}else{
dead = true
}
///GETTING HIT///
if(this.HP >= 1){
if(_root.bullet01.hitTest(_x,_y)){
trace("hit guy")
this.HP -= _global.power
}
}else {
this.HP = 0
this.gotoAndStop("dead");
}
////////////////
//AI///
if(dead == false){
var angle:Number = Math.atan2 (_root.hero._y - this._y, _root.hero._x - this._x);
this._rotation = angle * 180 / Math.PI;
if(this._x >= (_root.hero._x)){
this._x -= 1
}
if(this._x <= (_root.hero._x)){
this._x += 1
}
if(this._y >= (_root.hero._y)){
this._y -= 1
}
if(this._y <= (_root.hero._y)){
this._y += 1
}
}
}
but what I want to do is for different levels load him from the library with code. So i could load like 5 for one level and 7 for the next. And also to be spawned randomly past the borders of the flash. So a checklist of what i want to know please
-Load enemy random position outside the movie (600 x 600)
-Have the above code on each of those enemys
-Easily changeable for different levels
please help. This coding has kept me up all night :insomniac: