# Random Spawning

**URL:** <https://phaser.discourse.group/t/random-spawning/3318>\
**Category:** Phaser 3\
**Created:** [August 1, 2019, 11:39am UTC](https://phaser.discourse.group/t/random-spawning/3318 "2019-08-01T11:39:37Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [August 1, 2019, 1:07pm UTC](https://phaser.discourse.group/t/random-spawning/3318/3 "2019-08-01T13:07:35Z")

</div>

Ok much appreciated, i’m just slightly new to the forum and phaser itself so was unaware. But my class constructor looks as follows:

```javascript
class Enemy extends Phaser.Physics.Arcade.Sprite {
    constructor(scene, x, y, key, type) {
        super(scene, x, y, key, type);
        this.scene = scene;
        this.x = x;
        this.y = y;

        this.enemy = this.scene.physics.add.sprite(x, y, 'player2', 'tank1');
}

```

I want my Enemy to spawn at random points across the map. Currently it spawns random but not spread out enough.

```javascript
//spawn multiple enemies      
        for (var i = 0; i < blength; i++)
        {
            this.physics.add.existing (new Enemy(this, this.rnd.integerInRange(120, 480) ));
        }

```

---

_[View the full topic](https://phaser.discourse.group/t/random-spawning/3318)._
