The enemy spawner in my game stop working all of a sudden, it was working fine until last week I just stop working, I’ve looked into it and tried to fix it but I still not working. Can you help me figure out why it’s not working.
// update code called every frame
EnemySpawner.prototype.update = function (dt) {
this.time += dt;
var randomspawn = (Math.random() - 0.5) * 2;
// If 1 Second has Passed
if (this.time > this.spawnNext) {
this.spawnNext = this.time + 1;
// Set Random Position
var position = this.entity.getPosition();
this.entity.setPosition(randomspawn * 20, position.y, position.z);
// Spawn Enemy
var templateAsset = this.app.assets.get(56441364);
var instance = templateAsset.resource.initialize();
}
};