diff --git a/examples/baseball/bat.js b/examples/baseball/bat.js index c7e3d8ebfb..a4509c53d8 100644 --- a/examples/baseball/bat.js +++ b/examples/baseball/bat.js @@ -14,18 +14,26 @@ Script.include("pitching.js"); (function() { var pitchingMachine = null; - this.startNearGrab = this.continueNearGrab = function() { - // send the avatar to the baseball location so that they're ready to bat - MyAvatar.location = "/baseball" - + this.pitchAndHideAvatar = function() { if (!pitchingMachine) { pitchingMachine = getOrCreatePitchingMachine(); Script.update.connect(function(dt) { pitchingMachine.update(dt); }); } pitchingMachine.start(); MyAvatar.shouldRenderLocally = false; + } + + this.startNearGrab = function() { + // send the avatar to the baseball location so that they're ready to bat + MyAvatar.location = "/baseball" + + pitchAndHideAvatar() }; + this.continueNearGrab = function() { + pitchAndHideAvatar() + } + this.releaseGrab = function() { if (pitchingMachine) { pitchingMachine.stop();