From cf0cbae7a41ce31502c0b548bf22b7474e27c6b7 Mon Sep 17 00:00:00 2001 From: 7ih <75285668+7ih@users.noreply.github.com> Date: Mon, 24 May 2021 10:35:44 -0400 Subject: [PATCH] Update source.js --- source/source.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/source.js b/source/source.js index 4272ea1..589b834 100644 --- a/source/source.js +++ b/source/source.js @@ -834,8 +834,8 @@ function Tether() { ) self.locked = false; else { - if (document.exitPointerLock) document.exitPointerLock(); self.locked = true; + paused = true; game.lastMousePosition = {x: NaN, y: NaN}; } } @@ -1694,8 +1694,7 @@ function Game() { } if (isNaN(self.lastMousePosition.x)) { - self.proximityToMuteButton = maximumPossibleDistanceBetweenTwoMasses; - self.proximityToPlayButton = maximumPossibleDistanceBetweenTwoMasses; + self.proximityToMuteButton = self.proximityToPlayButton = maximumPossibleDistanceBetweenTwoMasses; } else { self.proximityToMuteButton = vectorMagnitude( forXAndY([muteButtonPosition, self.lastMousePosition], forXAndY.subtract), @@ -1911,6 +1910,18 @@ function Game() { y: height / 3 + 55, }, }); + + draw({ + type: 'text', + text: + {touch: 'drag', mouse: 'click'}[self.tether.lastInteraction] + 'to start', + fillStyle: rgbWithOpacity([0, 0, 0], opacity), + fontSize: 30, + textPosition: { + x: width / 2, + y: height / 3 - 20, + }, + }); }; self.drawRestartTutorial = function () { @@ -2171,13 +2182,12 @@ function Game() { }; self.positionShouldPlay = function (position) { + if (!(self.started && !self.ended)) return false; + if (paused) return true; self.proximityToPlayButton = vectorMagnitude( forXAndY([playButtonPosition, position], forXAndY.subtract), ); - return ( - (self.started && !self.ended) && - self.proximityToPlayButton < playButtonProximityThreshold - ); + return (self.proximityToPlayButton < playButtonProximityThreshold); }; self.drawMuteButton = function () {