-
multiple enemies
Hy
I am developing game in which I have created single enemy by following script
Now if any one can help creating multiple enemy with different name instances except enemy that i uses...
Please help
-------------------------------------------------------Code---------------------
score = 0;
i = 0;
enemies = [];
spawnEnemy = function(){
_root.attachMovie("enemy", "enemy"+i,_root.getNextHighestDepth());
_root["enemy"+i]._x = random(Stage.width);
_root["enemy"+i]._y = 0;
enemies.push("enemy"+i);
_root["enemy"+i].onEnterFrame = function(){
this._y += 22;
if(this.hitTest(_root.player)){
for(e = 0; e < _root.enemies.length; e++){
if(_root.enemies[e] == this._name){
_root.enemies.splice(e, 1);
}
}
//this.attachMovie("glow");
this.removeMovieClip();
_root.lives--;
hrt.play();
}
if(this._y > Stage.height){
for(e = 0; e < _root.enemies.length; e++){
if(_root.enemies[e] == this._name){
_root.enemies.splice(e, 1);
}
}
this.removeMovieClip();
}
}
i++;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|