Every 2 seconds, create sprite

Every 2 seconds, create a sprite
If this sprite collides with another, destroy the sprite
And if this sprite is destroyed, it creates a new sprite

Somebody could help me?

For the first part, I came up with this but it doesn’t work.

function base() {
	this.physics.add.sprite(50, 50, 'base')
}

function createBase() {
	this.time.addEvent({
		callback: base,
		delay: 1000,
		callbackScope: this,
		loop: false,
	})
}

2 Likes