From a8c6e2d58aaacbfe0c64f5e0c911131138de33ab Mon Sep 17 00:00:00 2001 From: Jennie Robinson Faber Date: Tue, 14 Nov 2023 14:18:34 -0500 Subject: [PATCH] Fix some clicks --- twine_src/scripts/2.init.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/twine_src/scripts/2.init.js b/twine_src/scripts/2.init.js index 9779908..fbe3c3b 100644 --- a/twine_src/scripts/2.init.js +++ b/twine_src/scripts/2.init.js @@ -2,7 +2,6 @@ window.setup = window.setup || {}; $(document).ready(function () { $.getScript("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"); - // Assuming setup.returnToMap is your function to return to the map setup.game = { planets: [ @@ -310,7 +309,6 @@ $(document).ready(function () { var mapScreen = document.getElementById("mapScreen"); var passage = document.getElementById("passage"); - // Clearing the content of planet-splash and rep var splashContainer = document.getElementById("planet-splash"); var repContainer = document.getElementById("rep"); @@ -437,6 +435,7 @@ $(document).ready(function () { } setup.renderPlayerPlanetPassage = function () { + story.state.currentPlanet = -1; var passage = document.getElementById("passage"); var passageContent = "

" + story.state.playerName + "'s Project

"; passageContent += "

" + story.state.playerPlanet.description + "

"; @@ -458,13 +457,14 @@ $(document).ready(function () { } } - // Add the player-screen class to HUD when displaying player planet content var hud = document.getElementById("hud"); if (hud) hud.classList.add("player-screen"); document .getElementById("planet-splash") .addEventListener("click", function () { - setup.returnToMap(); + if (story.state.currentPlanet === -1) { + setup.returnToMap(); + } }); }; @@ -741,6 +741,7 @@ $(document).ready(function () { console.log("Player's planet clicked"); setup.renderPlayerPlanetPassage(); setup.toggleHUD(true); + story.state.currentPlanet = -1; }; setup.attachEventListenersToPlanets = function () {