Skip to content

Commit

Permalink
Fix some clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
jennie committed Nov 14, 2023
1 parent 5db79df commit a8c6e2d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions twine_src/scripts/2.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -437,6 +435,7 @@ $(document).ready(function () {
}

setup.renderPlayerPlanetPassage = function () {
story.state.currentPlanet = -1;
var passage = document.getElementById("passage");
var passageContent = "<h2>" + story.state.playerName + "'s Project</h2>";
passageContent += "<p>" + story.state.playerPlanet.description + "</p>";
Expand All @@ -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();
}
});
};

Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit a8c6e2d

Please sign in to comment.