-
Hittest problem
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);
}
}
}
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
|