I just need to know how to do it correctly… So I can spawn enemies, and NOT have the depths of their projectiles overlapping.
Any guides/advice appreciated! Btw… Heres my progress so far:
Arrow keys, ctrl-cannon, mouse-missile.
http://photobucket.com/albums/y232/minyMonkey/?action=view¤t=tank.swf
Prototypes within classes is that… Okay? LoL! My problem is… The depths of the projectiles overlap… When I create more than one enemeyTurret.
If I increase the counter… It works fine, which does not make sense, because both start counting at the same time, and should overlap depths.
I just set the bullet number to 200, and made six start firing simoultainiously… The depths do not overlap. I don’t get it?
class enemyTurret extends MovieClip {
private function onEnterFrame() {
this._x += _root.landSpeed;
}
private function onLoad() {
var bullet = 1;
MovieClip.prototype.fireEnemyCannon = function() {
if (bullet>=10) {
bullet = 0;
}
_root.enemyBullet0.duplicateMovieClip("enemyBullet"+(bullet++), bullet+200, {_visible:true, _rotation:this.launchB.r, _x:this.launchB.x, _y:this.launchB.y, gravity:.25, speed:15, friction:.99});
};
}
}