Ok much appreciated, i’m just slightly new to the forum and phaser itself so was unaware. But my class constructor looks as follows:
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.
//spawn multiple enemies
for (var i = 0; i < blength; i++)
{
this.physics.add.existing (new Enemy(this, this.rnd.integerInRange(120, 480) ));
}