From 278c921a50031ed8d85d7ce48665d7643163d9dc Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 9 Nov 2015 11:35:56 -0800 Subject: [PATCH] Clean up bat.js --- examples/baseball/bat.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/baseball/bat.js b/examples/baseball/bat.js index eedda1e82a..5ca41b6c64 100644 --- a/examples/baseball/bat.js +++ b/examples/baseball/bat.js @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +Script.include("pitching.js"); + (function() { - Script.include("pitching.js"); var pitchingMachine = null; - this.startNearGrab = function() { - print("Started near grab!"); + + this.startNearGrab = this.continueNearGrab = function() { if (!pitchingMachine) { pitchingMachine = getOrCreatePitchingMachine(); Script.update.connect(function(dt) { pitchingMachine.update(dt); }); @@ -21,16 +22,8 @@ pitchingMachine.start(); MyAvatar.shouldRenderLocally = false; }; - this.continueNearGrab = function() { - if (!pitchingMachine) { - pitchingMachine = getOrCreatePitchingMachine(); - Script.update.connect(function(dt) { pitchingMachine.update(dt); }); - } - pitchingMachine.start(); - MyAvatar.shouldRenderLocally = false; - } + this.releaseGrab = function() { - print("Stopped near grab!"); if (pitchingMachine) { pitchingMachine.stop(); }