Skip to content

Commit

Permalink
Error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Death7Bed committed Sep 14, 2023
1 parent 210ef74 commit fed63b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public void create() {
private void displayUI() {
Entity ui = new Entity();
ui.addComponent(new GameAreaDisplay("Box Forest"));
ui.addComponent(ServiceLocator.getGameEndService().getDisplay());
ui.addComponent(ServiceLocator.getCurrencyService().getDisplay());
spawnEntity(ui);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
import com.csse3200.game.GdxGame;
import com.csse3200.game.entities.factories.RenderFactory;
import com.csse3200.game.rendering.Renderer;
import com.csse3200.game.services.GameEndService; // Import the GameEndService
import com.csse3200.game.screens.text.AnimatedText;
import com.csse3200.game.screens.Planets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Text;
import com.csse3200.game.services.ServiceLocator;


/**
* The game screen where you can choose a planet to play on.
Expand Down Expand Up @@ -51,10 +54,13 @@ public LevelSelectScreen(GdxGame game) {
public void show() {
batch = new SpriteBatch();
background = new Sprite(new Texture(BG_PATH));

// Register the gameEndService here before using it
ServiceLocator.registerGameEndService(new GameEndService()); // Replace 'new GameEndService()' with your actual implementation
}

/**
* Spawns the planets on the screen by doing contionous calls to spawnPlanet().
* Spawns the planets on the screen by doing continuous calls to spawnPlanet().
* The rotation speed of a planet is determined by the frame variable, this
* function can be modified.
*/
Expand Down Expand Up @@ -110,13 +116,12 @@ private void spawnPlanetBorders() {
handleLavaPlanetClick();
}
}
} else {
Sprite planetBorder = new Sprite(new Texture("planets/planetBorder.png"));
batch.draw(planetBorder, planet[0] - 2, planet[1] - 2, planet[2] + 3, planet[3] + 3);
}
} else {
Sprite planetBorder = new Sprite(new Texture("planets/planetBorder.png"));
batch.draw(planetBorder, planet[0] - 2, planet[1] - 2, planet[2] + 3, planet[3] + 3);
}
}

}

private void handleDesertPlanetClick() {
// Implement logic for when the desert planet is clicked
Expand All @@ -136,7 +141,6 @@ private void handleLavaPlanetClick() {
game.setScreen(new LavaGameScreen(game)); // Load the LavaGameScreen
}


// TODO: Make it display information about the planet
@Override
public void render(float delta) {
Expand Down

0 comments on commit fed63b8

Please sign in to comment.