-
Notifications
You must be signed in to change notification settings - Fork 9
PlanetScreen Class
Shaivika Anand edited this page Oct 26, 2023
·
3 revisions
The PlanetScreen
class is a component of game codebase, responsible for representing individual planets in the game with their corresponding game areas. It manages the generation of game areas, player movement, and various game-related services
- Class Name: PlanetScreen
- Extends: com.badlogic.gdx.ScreenAdapter
- Dependencies: Various libraries from the libGDX game development framework.
-
Description: Construct the
PlanetScreen
instance for the planet of a given name. -
Parameters:
-
game
: The current game instance to display the screen on. -
name
: The name of the planet to create a screen for.
-
- Description: Create the screen services and game areas on display.
- Usage: Called when the screen is first displayed.
- Description: Get the name of the next planet in the sequence after the current planet.
- Return: The name of the next planet.
- Description: Set the current game area the player is on.
-
Parameters:
-
name
: The name of the game area.
-
- Return: Whether the new game area was set correctly.
- Description: Get the currently displayed game area.
-
Return: The
MapGameArea
being utilized.
- Description: Get the name of the currently displayed game area.
- Return: The name of the area.
- Description: Render the game screen.
-
Parameters:
-
delta
: The time since the last render in seconds.
-
- Description: Resize the game screen.
-
Parameters:
-
width
: The new width of the screen. -
height
: The new height of the screen.
-
- Description: Pause the game.
- Description: Resume the game.
- Description: Dispose of resources and services.
- Usage: Called when the screen is no longer needed.
- Description: Save the game state.
- Description: Load assets required for the screen.
- Description: Unload assets used by the screen.
- Description: Create the game's UI elements.
- Description: Move the camera to follow the player around.
-
Attributes:
private final GdxGame game
public final String name
private String nextPlanetName
private Entity player
private String currentAreaName
private final Map<String, MapGameArea> allGameAreas
private LevelConfig levelConfig
private static final Vector2 CAMERA_POSITION
private Renderer renderer
private PhysicsEngine physicsEngine
public static boolean titleBoxDisplayed
private AssetsConfig assets
// Creating a PlanetScreen instance
PlanetScreen planetScreen = new PlanetScreen(game, "Earth");
// Setting the current game area
planetScreen.setCurrentArea("Area1");
// Getting the name of the next planet
String nextPlanet = planetScreen.getNextPlanetName();
// Rendering the screen
planetScreen.render(0.1f);
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files