am having a problem with my hittest, the test which is suppose to check to see if the shoot that comes from my spaceship mc, hits the enemy which is generated in the exact same way which the shoots in the fireShoots function are is not being detected at all i have tried using a loop in order to keep track of the multiple shoots that are being created but even then it still doesnt work am at my wits end please help me.
thanks in advance dbomb101
function fireShoots() {
var shoot = "shoot";
var depth = _root.getNextHighestDepth();
var newname = "shoot"+_root.ShootNum++;
_root.attachMovie(shoot, newname, depth);
_root[newname]._y = _root.avatar2._y-23;
_root[newname]._x = _root.avatar2._x+1;
_root[newname].onEnterFrame = function() {
var bullet_speed = 7;
this._y -= bullet_speed;
if (this._y<0) {
this.removeMovieClip();
}
};
for (var i = 0; i<enemyNum; i++) {
var myEnemy = _root["enemy"+i] //enemy0, enemy1, enemy2
if (this.hitTest(myEnemy)) {
this.removeMovieClip();
_root.score++;
//trace("enemy"+i);
}
}
}
I haven't gotten a chance to fix the problem yet but redid the attaching so when firing it doesn't slow the computer down like it did before. I'll check it a bit later.
yeah actually the older one was slower although this one slows down when to many enemies are hit by the bullet but i wont be using anymore than 4 to 5 at a time
anyway thanx for the help