mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 22:47:54 +02:00
Add handling of lost entities to shortbow
This commit is contained in:
parent
4df2489ff9
commit
0e1d9b9d56
1 changed files with 24 additions and 24 deletions
|
@ -10,13 +10,13 @@ var TARGET_HIT_SOUND = SoundCache.getSound(Script.resolvePath("assets/sounds/tar
|
||||||
var ESCAPE_SOUND = SoundCache.getSound(Script.resolvePath("assets/sounds/escape.wav"));
|
var ESCAPE_SOUND = SoundCache.getSound(Script.resolvePath("assets/sounds/escape.wav"));
|
||||||
|
|
||||||
// +--------+ +-----------+ +-----------------+
|
// +--------+ +-----------+ +-----------------+
|
||||||
// | | | <------+ |
|
// | | | |<-----+ |
|
||||||
// | IDLE +------> PLAYING | | BETWEEN_WAVES |
|
// | IDLE +----->| PLAYING | | BETWEEN_WAVES |
|
||||||
// | | | +------> |
|
// | | | +----->| |
|
||||||
// +----^---+ +-----+-----+ +-----------------+
|
// +--------+ +-----+-----+ +-----------------+
|
||||||
// | |
|
// ^ |
|
||||||
// | |
|
// | v
|
||||||
// | +------v------+
|
// | +-------------+
|
||||||
// | | |
|
// | | |
|
||||||
// +---------+ GAME_OVER |
|
// +---------+ GAME_OVER |
|
||||||
// | |
|
// | |
|
||||||
|
@ -134,9 +134,10 @@ var baseEnemyProperties = {
|
||||||
velocity: {
|
velocity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: -30
|
z: -3
|
||||||
},
|
},
|
||||||
script: Script.resolvePath('enemyEntity.js'),
|
script: Script.resolvePath('enemyEntity.js'),
|
||||||
|
serverScripts: "null"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,9 +303,8 @@ ShortbowGameManager.prototype = {
|
||||||
this.spawnQueue = [];
|
this.spawnQueue = [];
|
||||||
this.spawnStartTime = Date.now();
|
this.spawnStartTime = Date.now();
|
||||||
|
|
||||||
print("Editing wave number 500", this.waveDisplayID, this.waveNumber);
|
Entities.editEntity(this.waveDisplayID, {
|
||||||
Entities.editEntity('{1b630f6a-a6e4-4bca-be5e-d8d2709bb278}', {
|
text: this.waveNumber
|
||||||
text: '500',//this.waveNumber
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var numberOfEnemiesLeftToSpawn = this.waveNumber * 2;
|
var numberOfEnemiesLeftToSpawn = this.waveNumber * 2;
|
||||||
|
@ -387,29 +387,29 @@ ShortbowGameManager.prototype = {
|
||||||
// Move this somewhere else?
|
// Move this somewhere else?
|
||||||
this.checkSpawnQueue();
|
this.checkSpawnQueue();
|
||||||
|
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
var enemiesEscaped = false;
|
var enemiesEscaped = false;
|
||||||
for (var i = this.enemyIDs.length - 1; i >= 0; --i) {
|
for (var i = this.enemyIDs.length - 1; i >= 0; --i) {
|
||||||
var position = Entities.getEntityProperties(this.enemyIDs[i], 'position').position;
|
var position = Entities.getEntityProperties(this.enemyIDs[i], 'position').position;
|
||||||
if (position === undefined) {
|
if (position === undefined) {
|
||||||
// If the enemy can no longer be found, assume it was hit
|
// If the enemy can no longer be found, assume it was hit
|
||||||
//this.enemyIDs.splice(i, 1);
|
|
||||||
//Audio.playSound(TARGET_HIT_SOUND, {
|
|
||||||
// volume: 1.0,
|
|
||||||
// position: this.rootPosition,
|
|
||||||
//});
|
|
||||||
//this.setScore(this.score + 100);
|
|
||||||
//enemiesEscaped = true;
|
|
||||||
} else if (position.z < this.gatePosition.z) {
|
|
||||||
Entities.deleteEntity(this.enemyIDs[i]);
|
|
||||||
this.enemyIDs.splice(i, 1);
|
this.enemyIDs.splice(i, 1);
|
||||||
this.setLivesLeft(this.livesLeft - 1);
|
Audio.playSound(TARGET_HIT_SOUND, {
|
||||||
Audio.playSound(ESCAPE_SOUND, {
|
|
||||||
volume: 1.0,
|
volume: 1.0,
|
||||||
position: this.rootPosition
|
position: this.rootPosition,
|
||||||
});
|
});
|
||||||
|
this.setScore(this.score + 100);
|
||||||
enemiesEscaped = true;
|
enemiesEscaped = true;
|
||||||
|
//} else if (position.z < this.gatePosition.z) {
|
||||||
|
//Entities.deleteEntity(this.enemyIDs[i]);
|
||||||
|
//this.enemyIDs.splice(i, 1);
|
||||||
|
//this.setLivesLeft(this.livesLeft - 1);
|
||||||
|
//Audio.playSound(ESCAPE_SOUND, {
|
||||||
|
//volume: 1.0,
|
||||||
|
//position: this.rootPosition
|
||||||
|
//});
|
||||||
|
//enemiesEscaped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print("LIVES LEFT: ", this.livesLeft, this.numberOfEntitiesLeftForWave);
|
//print("LIVES LEFT: ", this.livesLeft, this.numberOfEntitiesLeftForWave);
|
||||||
|
|
Loading…
Reference in a new issue