Package com.dragonboat.game
Class GameScreen
- java.lang.Object
-
- com.dragonboat.game.GameScreen
-
- All Implemented Interfaces:
com.badlogic.gdx.Screen
public class GameScreen extends java.lang.Object implements com.badlogic.gdx.Screen
Main Game Screen class for Dragon Boat Game. This is the main game loop, handling all the game logic and rendering.
-
-
Constructor Summary
Constructors Constructor Description GameScreen(DragonBoatGame game)
Sets up everything needed for a race to take place.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes of the screen when it is no longer needed.void
hide()
void
pause()
void
render(float deltaTime)
Rendering function for the game loop, handling all game logic and displaying graphics.void
resize(int width, int height)
Resizes the game screen.void
resume()
void
show()
-
-
-
Constructor Detail
-
GameScreen
public GameScreen(DragonBoatGame game)
Sets up everything needed for a race to take place.- Parameters:
game
- Represents the initial state of DragonBoatGame.
-
-
Method Detail
-
render
public void render(float deltaTime)
Rendering function for the game loop, handling all game logic and displaying graphics.
GAME LOOP
- Spawns any Obstacles that need spawning.
- Update Player and Opponent positions.
- Check for collisions with Obstacles.
- Display Background and Obstacles
- Update Obstacle positions.
- Display Player, Player UI and Opponents.
- Display Progress Bar and checks which boats have finished.
- Display Player timer.
- Checks if all boats have finished, and displays a Leaderboard if so.
- Specified by:
render
in interfacecom.badlogic.gdx.Screen
- Parameters:
deltaTime
- Time passed since render function was last run.
-
resize
public void resize(int width, int height)
Resizes the game screen.- Specified by:
resize
in interfacecom.badlogic.gdx.Screen
- Parameters:
width
- Width of the screen.height
- Height of the screen.
-
pause
public void pause()
- Specified by:
pause
in interfacecom.badlogic.gdx.Screen
-
resume
public void resume()
- Specified by:
resume
in interfacecom.badlogic.gdx.Screen
-
hide
public void hide()
- Specified by:
hide
in interfacecom.badlogic.gdx.Screen
-
dispose
public void dispose()
Disposes of the screen when it is no longer needed.- Specified by:
dispose
in interfacecom.badlogic.gdx.Screen
-
show
public void show()
- Specified by:
show
in interfacecom.badlogic.gdx.Screen
-
-