Skip to content

Commit

Permalink
Bug Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Death7Bed committed Sep 14, 2023
1 parent 05a4d2f commit 6e4b138
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ private void spawnPlanetBorders() {
for (int[] planet : Planets.PLANETS) {
Rectangle planetRect = new Rectangle(planet[0], planet[1], planet[2], planet[3]);
if (planetRect.contains(mousePos.x, (float) Gdx.graphics.getHeight() - mousePos.y)) {
// If a planet is clicked it will load the level based on the planet
// If the mouse is over a planet, draw the planet border
Sprite planetBorder = new Sprite(new Texture("planets/planetBorder.png"));
batch.draw(planetBorder, planet[0] - 2.0f, planet[1] - 2.0f, planet[2] + 3.0f, planet[3] + 3.0f);
if (Gdx.input.justTouched()) {
// If the planet is clicked, load the corresponding level
dispose();
logger.info("Loading level {}", planet[4]);
GameLevelData.setSelectedLevel(planet[4]);
Expand All @@ -117,12 +120,9 @@ private void spawnPlanetBorders() {
}
}
}
else {
Sprite planetBorder = new Sprite(new Texture("planets/planetBorder.png"));
batch.draw(planetBorder, planet[0] - 2.0f, planet[1] - 2.0f, planet[2] + 3.0f, planet[3] + 3.0f);
}
}
}

private void handleDesertPlanetClick() {
// Implement logic for when the desert planet is clicked
logger.info("Desert planet clicked.");
Expand Down

0 comments on commit 6e4b138

Please sign in to comment.