# Need advice for spawn system

**URL:** <https://forum.kirupa.com/t/need-advice-for-spawn-system/178154>\
**Category:** Uncategorized\
**Created:** [February 8, 2006, 3:45am UTC](https://forum.kirupa.com/t/need-advice-for-spawn-system/178154 "2006-02-08T03:45:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zicemaster](https://avatars.discourse-cdn.com/v4/letter/z/b77776/32.png) [@zicemaster](https://forum.kirupa.com/u/zicemaster)\
**Post date:** [February 8, 2006, 3:45am UTC](https://forum.kirupa.com/t/need-advice-for-spawn-system/178154/1 "2006-02-08T03:45:19Z")

</div>

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&current=tank.swf](http://photobucket.com/albums/y232/minyMonkey/?action=view&current=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?

```auto

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

```
