mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:57:59 +02:00
Add random jumping to targets in wave game
This commit is contained in:
parent
9f5435133a
commit
40b428c788
1 changed files with 12 additions and 0 deletions
|
@ -146,6 +146,12 @@ GameManager.prototype = {
|
||||||
this.checkEnemyPositionsTimer = null;
|
this.checkEnemyPositionsTimer = null;
|
||||||
this.enemyIDs = [];
|
this.enemyIDs = [];
|
||||||
|
|
||||||
|
// SpawnQueue is a list of enemies left to spawn. Each entry looks like:
|
||||||
|
//
|
||||||
|
// { spawnAt: 1000, position: { x: 0, y: 0, z: 0 } }
|
||||||
|
//
|
||||||
|
// where spawnAt is the number of millseconds after the start of the wave
|
||||||
|
// to spawn the enemy. The list is sorted by spawnAt, ascending.
|
||||||
this.spawnQueue = [];
|
this.spawnQueue = [];
|
||||||
|
|
||||||
this.gameState = GAME_STATES.PLAYING;
|
this.gameState = GAME_STATES.PLAYING;
|
||||||
|
@ -223,6 +229,12 @@ GameManager.prototype = {
|
||||||
var entityID = Entities.addEntity(baseEnemyProperties);
|
var entityID = Entities.addEntity(baseEnemyProperties);
|
||||||
this.enemyIDs.push(entityID);
|
this.enemyIDs.push(entityID);
|
||||||
this.spawnQueue.splice(0, 1);
|
this.spawnQueue.splice(0, 1);
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
var velocity = Entities.getEntityProperties(entityID, 'velocity').velocity;
|
||||||
|
velocity.y += 5;
|
||||||
|
Entities.editEntity(entityID, { velocity: velocity });
|
||||||
|
|
||||||
|
}, 500 + Math.random() * 4000);
|
||||||
}
|
}
|
||||||
print("Spawn queue size: ", this.spawnQueue.length, "Elapsed time: ", waveElapsedTime, "Number of enemies:", this.enemyIDs.length);
|
print("Spawn queue size: ", this.spawnQueue.length, "Elapsed time: ", waveElapsedTime, "Number of enemies:", this.enemyIDs.length);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue