Skip to content

Commit

Permalink
Fix player planet display
Browse files Browse the repository at this point in the history
  • Loading branch information
jennie committed Nov 13, 2023
1 parent 4b93e51 commit 800bf14
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions twine_src/scripts/2.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,24 @@ $(document).ready(function () {
mapScreen.appendChild(planetContainer);
checkAllPlanetsLoaded(++loadedPlanets, totalPlanets);
});
if (story.state.playerPlanet) {
const playerPlanet = story.state.playerPlanet;
const playerPlanetContainer = document.createElement("div");
playerPlanetContainer.className = `planet-container planet-container-player`;

const img = document.createElement("img");
img.className = `planet player-planet`;
img.src = playerPlanet.imgSrc;

const clickHandler = setup.handlePlanetClick(-1);
setup.planetClickHandlers[-1] = clickHandler;
img.addEventListener("click", clickHandler);

playerPlanetContainer.appendChild(img);
setup.appendTooltip(playerPlanet, playerPlanetContainer);
mapScreen.appendChild(playerPlanetContainer);
checkAllPlanetsLoaded(++loadedPlanets, totalPlanets);
}
}
};

Expand Down

0 comments on commit 800bf14

Please sign in to comment.