# Enemy Spawning?

**URL:** https://forum.kirupa.com/t/enemy-spawning/302020
**Category:** programming
**Created:** [December 19, 2009, 10:44pm UTC](https://forum.kirupa.com/t/enemy-spawning/302020 "2009-12-19T22:44:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Press\_Tilty](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Press\_Tilty](https://forum.kirupa.com/u/Press_Tilty)
#### Post date: [December 19, 2009, 10:44pm UTC](https://forum.kirupa.com/t/enemy-spawning/302020/1 "2009-12-19T22:44:41Z")

</div>

Okay, I have this code:

```auto

var i:Number = 0;
var SpawnPointX:Number = 345;
var SpawnPointY:Number = -30;

onEnterFrame = function () {
	SpawnEnemy();
};
function SpawnEnemy() {
	duplicateMovieClip(_root.virus,"virus"+i,i);
	Dod = _root["virus"+i];
	Dod._y = SpawnPointY;
	Dod._x = SpawnPointX;
	i++;
}

```

It is from this tutorial: [http://www.gamegum.com/game/3461/ultra-platformer-tutorial!/](http://www.gamegum.com/game/3461/ultra-platformer-tutorial!/)  
It has worked for me before, and now it isnt,

My movieclip is named “virus” on-stage, “virus” in the library, and exported for AS as “virus” Whats the problem?

Also, if there is an alternate suggestion for spawning, that’d be great. Oh, and there is code on the enemy, so it needs to keep that code.
