Skip to content

Commit

Permalink
Update source.js
Browse files Browse the repository at this point in the history
  • Loading branch information
7ih authored May 24, 2021
1 parent 5f0837e commit cf0cbae
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions source/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit cf0cbae

Please sign in to comment.