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.ScreenMain 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 voiddispose()Disposes of the screen when it is no longer needed.voidhide()voidpause()voidrender(float deltaTime)Rendering function for the game loop, handling all game logic and displaying graphics.voidresize(int width, int height)Resizes the game screen.voidresume()voidshow()
-
-
-
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:
renderin 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:
resizein interfacecom.badlogic.gdx.Screen- Parameters:
width- Width of the screen.height- Height of the screen.
-
pause
public void pause()
- Specified by:
pausein interfacecom.badlogic.gdx.Screen
-
resume
public void resume()
- Specified by:
resumein interfacecom.badlogic.gdx.Screen
-
hide
public void hide()
- Specified by:
hidein interfacecom.badlogic.gdx.Screen
-
dispose
public void dispose()
Disposes of the screen when it is no longer needed.- Specified by:
disposein interfacecom.badlogic.gdx.Screen
-
show
public void show()
- Specified by:
showin interfacecom.badlogic.gdx.Screen
-
-