From 0e1d9b9d567004ab616931a4440e448726114a1f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 31 Jan 2017 13:16:39 -0800 Subject: [PATCH] Add handling of lost entities to shortbow --- .../towerDefense/shortbowGameManager.js | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/towerDefense/shortbowGameManager.js b/unpublishedScripts/DomainContent/Toybox/towerDefense/shortbowGameManager.js index f9d9ef2e12..0745597119 100644 --- a/unpublishedScripts/DomainContent/Toybox/towerDefense/shortbowGameManager.js +++ b/unpublishedScripts/DomainContent/Toybox/towerDefense/shortbowGameManager.js @@ -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")); // +--------+ +-----------+ +-----------------+ -// | | | <------+ | -// | IDLE +------> PLAYING | | BETWEEN_WAVES | -// | | | +------> | -// +----^---+ +-----+-----+ +-----------------+ -// | | -// | | -// | +------v------+ +// | | | |<-----+ | +// | IDLE +----->| PLAYING | | BETWEEN_WAVES | +// | | | +----->| | +// +--------+ +-----+-----+ +-----------------+ +// ^ | +// | v +// | +-------------+ // | | | // +---------+ GAME_OVER | // | | @@ -134,9 +134,10 @@ var baseEnemyProperties = { velocity: { x: 0, y: 0, - z: -30 + z: -3 }, script: Script.resolvePath('enemyEntity.js'), + serverScripts: "null" }; @@ -302,9 +303,8 @@ ShortbowGameManager.prototype = { this.spawnQueue = []; this.spawnStartTime = Date.now(); - print("Editing wave number 500", this.waveDisplayID, this.waveNumber); - Entities.editEntity('{1b630f6a-a6e4-4bca-be5e-d8d2709bb278}', { - text: '500',//this.waveNumber + Entities.editEntity(this.waveDisplayID, { + text: this.waveNumber }); var numberOfEnemiesLeftToSpawn = this.waveNumber * 2; @@ -387,29 +387,29 @@ ShortbowGameManager.prototype = { // Move this somewhere else? this.checkSpawnQueue(); - return; + //return; var enemiesEscaped = false; for (var i = this.enemyIDs.length - 1; i >= 0; --i) { var position = Entities.getEntityProperties(this.enemyIDs[i], 'position').position; if (position === undefined) { // 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.setLivesLeft(this.livesLeft - 1); - Audio.playSound(ESCAPE_SOUND, { + Audio.playSound(TARGET_HIT_SOUND, { volume: 1.0, - position: this.rootPosition + 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.setLivesLeft(this.livesLeft - 1); + //Audio.playSound(ESCAPE_SOUND, { + //volume: 1.0, + //position: this.rootPosition + //}); + //enemiesEscaped = true; } } //print("LIVES LEFT: ", this.livesLeft, this.numberOfEntitiesLeftForWave);