Class GameScreen

  • All Implemented Interfaces:
    com.badlogic.gdx.Screen

    public class GameScreen
    extends java.lang.Object
    implements com.badlogic.gdx.Screen
    Contains the main game logic
    Author:
    Riju De, lnt20
    • Constructor Detail

      • GameScreen

        public GameScreen​(Kroy _game,
                          int truckNum)
        Parameters:
        _game -
        truckNum -
    • Method Detail

      • show

        public void show()
        Screen first shown
        Specified by:
        show in interface com.badlogic.gdx.Screen
      • render

        public void render​(float delta)
        Called every frame
        Specified by:
        render in interface com.badlogic.gdx.Screen
      • addGameObject

        public void addGameObject​(GameObject gameObject)
        Add a game object next frame
        Parameters:
        gameObject - gameObject to be added
      • getPlayer

        public FireTruck getPlayer()
        Allows external classes to access the player
        Returns:
        player
      • DrawLine

        public void DrawLine​(com.badlogic.gdx.math.Vector2 start,
                             com.badlogic.gdx.math.Vector2 end,
                             int lineWidth,
                             com.badlogic.gdx.graphics.Color colour)
        Draw a debug line
        Parameters:
        start - Start of the line
        end - End of the line
        lineWidth - Width of the line
        colour - Colour of the line
      • DrawCircle

        public void DrawCircle​(com.badlogic.gdx.math.Vector2 position,
                               float radius,
                               int lineWidth,
                               com.badlogic.gdx.graphics.Color colour)
        Draw a debug circle (outline)
        Parameters:
        position - Centre of the circle
        radius - Radius of the circle
        lineWidth - Width of the outline
        colour - Colour of the line
      • DrawRect

        public void DrawRect​(com.badlogic.gdx.math.Vector2 bottomLeft,
                             com.badlogic.gdx.math.Vector2 dimensions,
                             int lineWidth,
                             com.badlogic.gdx.graphics.Color colour)
        Draw a debug rectangle (outline)
        Parameters:
        bottomLeft - Bottom left point of the rectangle
        dimensions - Dimensions of the rectangle (Width, Length)
        lineWidth - Width of the outline
        colour - Colour of the line
      • updateCamera

        public void updateCamera()
        Updates the position of the camera to have the truck centre
      • resize

        public void resize​(int width,
                           int height)
        Specified by:
        resize in interface com.badlogic.gdx.Screen
      • pause

        public void pause()
        Specified by:
        pause in interface com.badlogic.gdx.Screen
      • resume

        public void resume()
        Specified by:
        resume in interface com.badlogic.gdx.Screen
      • hide

        public void hide()
        Specified by:
        hide in interface com.badlogic.gdx.Screen
      • dispose

        public void dispose()
        Specified by:
        dispose in interface com.badlogic.gdx.Screen
      • getGameObject

        public GameObject getGameObject​(int index)
        Parameters:
        index -
        Returns:
      • getGameObjects

        public java.util.List<GameObject> getGameObjects()
        Returns:
      • getLives

        public int getLives()
      • addFortress

        public void addFortress()
        Add one fortress to the count
      • removeFortress

        public void removeFortress()
        Remove one fortress to the count
      • fortressesLeft

        public int fortressesLeft()
        How many fortresses are left?
        Returns:
        Number of fortresses remaining
      • gameOver

        public void gameOver​(boolean won)
        Switch to the game over screen
        Parameters:
        won - Did the player reach the win state?
      • updateLives

        public void updateLives()
      • respawn

        public void respawn()
        Respawns the player at the spawn position and updates the HUD
      • getHud

        public HUD getHud()
      • getSpawnPosition

        public com.badlogic.gdx.math.Vector2 getSpawnPosition()