diff --git a/unpublishedScripts/marketplace/shortbow/bow/bow.js b/unpublishedScripts/marketplace/shortbow/bow/bow.js index 67209845d1..f8ef025728 100644 --- a/unpublishedScripts/marketplace/shortbow/bow/bow.js +++ b/unpublishedScripts/marketplace/shortbow/bow/bow.js @@ -102,8 +102,7 @@ function getControllerLocation(controllerHand) { const SHOOT_ARROW_SOUND_URL = Script.resolvePath('String_release2.L.wav'); const STRING_PULL_SOUND_URL = Script.resolvePath('Bow_draw.1.L.wav'); const ARROW_HIT_SOUND_URL = Script.resolvePath('Arrow_impact1.L.wav'); - const SMOKE_URL = Script.resolvePath('smoke.png'); - + const ARROW_MODEL_URL = Script.resolvePath('arrow.fbx'); const ARROW_DIMENSIONS = { x: 0.20, @@ -387,14 +386,8 @@ function getControllerLocation(controllerHand) { Script.removeEventHandler(arrow, "collisionWithEntity", makeArrowStick); }; - var makeBallGoPoof = function(entityA, entityB, collision) { - print("Entity hit: " + entityB); - Script.removeEventHandler(arrow, "collisionWithEntity", makeBallGoPoof); - }); - Script.addEventHandler(arrow, "collisionWithEntity", makeArrowStick); - Script.addEventHandler(arrow, "collisionWithEntity", makeBallGoPoof); - + return arrow; }, @@ -627,7 +620,6 @@ function getControllerLocation(controllerHand) { Audio.playSound(this.arrowNotchSound, audioProperties); }, - // This function isn't used anymore. changeStringPullSoundVolume: function(pullBackDistance) { var audioProperties = { volume: this.scaleSoundVolume(pullBackDistance), diff --git a/unpublishedScripts/marketplace/shortbow/bow/smoke.png b/unpublishedScripts/marketplace/shortbow/bow/smoke.png index 4d6870b8f9..55618da1b0 100644 Binary files a/unpublishedScripts/marketplace/shortbow/bow/smoke.png and b/unpublishedScripts/marketplace/shortbow/bow/smoke.png differ diff --git a/unpublishedScripts/marketplace/shortbow/enemyClientEntity.js b/unpublishedScripts/marketplace/shortbow/enemyClientEntity.js index 3abdaa46fb..23d85be560 100644 --- a/unpublishedScripts/marketplace/shortbow/enemyClientEntity.js +++ b/unpublishedScripts/marketplace/shortbow/enemyClientEntity.js @@ -38,13 +38,50 @@ this.entityIDsThatHaveCollidedWithMe.push(entityB); var colliderName = Entities.getEntityProperties(entityB, 'name').name; - if (colliderName.indexOf("projectile") > -1) { + var smokeImage = { + accelerationSpread: { x: 0, y: 0, z: 0 }, + alpha: 1, + alphaFinish: 0, + alphaSpread: 0, + alphaStart: 0.3, + azimuthFinish: 3.1, + azimuthStart: -3.14159, + color: { red: 255, green: 255, blue: 255 }, + colorFinish: { red: 255, green: 255, blue: 255 }, + colorSpread: { red: 0, green: 0, blue: 0 }, + colorStart: { red: 255, green: 255, blue: 255 }, + emitAcceleration: { x: 0, y: 0, z: 0 }, + emitDimensions: { x: 0, y: 0, z: 0 }, + emitOrientation: { x: -0.7, y: 0.0, z: 0.0, w: 0.7 }, + emitRate: 0.01, + emitSpeed: 0, + emitterShouldTrail: 0, + isEmitting: 1, + lifespan: 0.5, + lifetime: 0.5, + maxParticles: 1000, + name: 'ball-hit-smoke', + position: Entities.getEntityProperties(entityA, 'position').position, + particleRadius: 0.132, + polarFinish: 0, + polarStart: 0, + radiusFinish: 0.35, + radiusSpread: 0, + radiusStart: 0.132, + speedSpread: 0, + textures: Script.resolvePath('bow/smoke.png'), + type: 'ParticleEffect' + }; + + Entities.addEntity(smokeImage); + Messages.sendMessage(this.gameChannel, JSON.stringify({ type: "enemy-killed", entityID: this.entityID, position: Entities.getEntityProperties(this.entityID, 'position').position })); + Entities.deleteEntity(this.entityID); } else if (colliderName.indexOf("GateCollider") > -1) { Messages.sendMessage(this.gameChannel, JSON.stringify({ diff --git a/unpublishedScripts/marketplace/shortbow/shortbowGameManager.js b/unpublishedScripts/marketplace/shortbow/shortbowGameManager.js index bd42e40427..c19c5e3bd3 100644 --- a/unpublishedScripts/marketplace/shortbow/shortbowGameManager.js +++ b/unpublishedScripts/marketplace/shortbow/shortbowGameManager.js @@ -468,6 +468,7 @@ ShortbowGameManager.prototype = { volume: 1.0, position: this.rootPosition }); + print("CAINK - BALL KILLED"); this.setScore(this.score + POINTS_PER_KILL); enemiesEscaped = true; } @@ -561,10 +562,11 @@ ShortbowGameManager.prototype = { } }, onEnemyKilled: function(entityID, position) { - if (this.gameState !== GAME_STATES.PLAYING) { + + if (this.gameState !== GAME_STATES.PLAYING) { return; } - + for (var i = this.remainingEnemies.length - 1; i >= 0; --i) { var enemy = this.remainingEnemies[i]; if (enemy.id === entityID) { @@ -573,7 +575,6 @@ ShortbowGameManager.prototype = { volume: 1.0, position: this.rootPosition }); - // Update score this.setScore(this.score + POINTS_PER_KILL); print("SCORE: ", this.score); @@ -592,6 +593,7 @@ ShortbowGameManager.prototype = { for (var i = this.remainingEnemies.length - 1; i >= 0; --i) { var enemy = this.remainingEnemies[i]; if (enemy.id === entityID) { + Entities.deleteEntity(enemy.id); this.remainingEnemies.splice(i, 1); this.setLivesLeft(this.livesLeft - 1);