Class ForestGameArea

java.lang.Object
com.deco2800.game.areas.GameArea
com.deco2800.game.areas.ForestGameArea
All Implemented Interfaces:
Disposable

public class ForestGameArea
extends GameArea
Forest area for the demo game with trees, a player, and some enemies.
  • Field Details

  • Constructor Details

  • Method Details

    • spawnNailsone

      public void spawnNailsone​(int xValue)
    • spawnNailstwo

      public void spawnNailstwo​(int xValue)
    • spawnNailsthree

      public void spawnNailsthree​(int xValue)
    • spawnNailsfour

      public void spawnNailsfour​(int xValue)
    • spawnWoodsone

      public void spawnWoodsone​(int xValue)
    • spawnWoodstwo

      public void spawnWoodstwo​(int xValue)
    • spawnWoodsthree

      public void spawnWoodsthree​(int xValue)
    • spawnWoodsfour

      public void spawnWoodsfour​(int xValue)
    • spawnWoodsfive

      public void spawnWoodsfive​(int xValue)
    • spawnFireRocksone

      public void spawnFireRocksone​(int xValue)
      Generate line 5 rocks in the new map
      Parameters:
      xValue - horizontal start point
    • spawnRockstwo

      public void spawnRockstwo​(int xValue)
      Generate rocks pyramid N NN NNN
      Parameters:
      xValue - horizontal start point
    • spawnFireRocksthree

      public void spawnFireRocksthree​(int xValue)
    • spawnFireRockstwo

      public void spawnFireRockstwo​(int xValue)
      Genrate large rock pyramid N NN NNN NNNN
      Parameters:
      xValue - horizontal start point
    • spawnWoodsRandomly

      public void spawnWoodsRandomly​(int xValue)
      Generate 5 wood randomly in the 52f and 54f height and given horizontal start point
      Parameters:
      xValue - horizontal start point
    • create

      public void create()
      Create the game area, including terrain, static entities (trees), dynamic entities (player)
      Specified by:
      create in class GameArea
    • InvSys

      public void InvSys()
    • showScrollingBackground

      public void showScrollingBackground​(int counter)
      Show background in the regular map according to the given counter
      Parameters:
      counter - change the horizontal start point of the background
    • showNewMapScrollingBackground

      public void showNewMapScrollingBackground​(int counter, float vertical)
      Show background in the new map according to the given horizontal and vertical start point
      Parameters:
      counter - change the horizontal start point
      vertical - change the vertical start point
    • spawnTerrain

      public void spawnTerrain​(TerrainFactory.TerrainType terrainType)
      Generate the first set of terrain
      Parameters:
      terrainType - change the type of the terrain
    • spawnTerrainRandomly

      public void spawnTerrainRandomly​(int xValue, TerrainFactory.TerrainType terrainType)
      Generate the continuous terrain after the first set of terrain
      Parameters:
      xValue - control the position of the terrain
      terrainType - change the type of the terrain
    • spawnInvisibleCeiling

      public void spawnInvisibleCeiling​(Vector2 worldBounds, GridPoint2 tileBounds)
      Generate invisible ceiling on top to avoid the character jump out of the map
      Parameters:
      worldBounds - wall position value
      tileBounds - tile position value
    • spawnObstacles

      public void spawnObstacles()
      Obstacles are randomly generated according to the position of the character. The first time it is called, NUM_OBSTACLES obstacles are generated in the range of (0-30) units after the player's position. For each subsequent call, the position of generating obstacles is twenty units behind the player, and the generating range is 20 units. Called by render() in MainGameScreen.java.

      For example, the first call to the player x position is 0, and the x range for generating obstacles is 0-30. The second call to the player's x position is 10, and the x range for generating obstacles is 31-50.

      Note: Reduce the range of obstacles generated for the first time, leaving enough space for the item group

    • spawnFlyingMonkey

      public void spawnFlyingMonkey()
      Generate Flying Monkeys at random locations. Called by render() in MainGameScreen.java
    • spawnFaceWorm

      public void spawnFaceWorm​(Vector2 position)
      Generate Face Worm at current Flying Monkeys location. Called by render() in MainGameScreen.java
      Parameters:
      position - the location of flying monkeys
    • spawnMeteorites

      public void spawnMeteorites​(int bigNum, int middleNum, int smallNum, int bigRandomRange, int midRandomRange, int smallRandomRange)
      Generate a certain number of meteorites, called by render() in MainGameScreen.java. The final number of meteorites is the sum of all parameters.

      Big size meteorites: 1.5 - 2 times of the multiples of meteorites texture, total number is bigNum(+bigRandomRange), the values in parentheses are random. Midden size meteorites: 1 - 1.5 times of the multiples of meteorites texture, total number is middleNum(+midRandomRange) Small size meteorites: 0.5 + randomSize: 0.5 - 1 times of the multiples of meteorites texture, total number is smallNum(+smallRandomRange)

      e.g. 1(+2) means that the number of generations is at least 1, and the final possible range is 1-3.

      Parameters:
      bigNum - At least the number of large meteorites generated.
      middleNum - At least the number of middle meteorites generated.
      smallNum - At least the number of small meteorites generated.
      bigRandomRange - The number of large meteorites that may be randomly generated.
      midRandomRange - The number of middle meteorites that may be randomly generated.
      smallRandomRange - The number of small meteorites that may be randomly generated.
    • spawnSpaceship

      public void spawnSpaceship()
      Generate Spaceship at fixed location.
    • spawnSmallMissile

      public void spawnSmallMissile​(Vector2 position)
      Generate Small Missile at Spaceship location. Called by render() in MainGameScreen.java
      Parameters:
      position - the location of Spaceship
    • spawnPortal

      public void spawnPortal​(Vector2 position, ObstacleEventHandler.ObstacleType type)
      Generate Small Missile at Spaceship location. Called by render() in MainGameScreen.java
      Parameters:
      position - the location of Spaceship
      type - ObstacleType category
    • spawnFirstAid

      public void spawnFirstAid()
    • spawnGoldNewMapRandomly

      public void spawnGoldNewMapRandomly​(int x)
      Generate another set of gold from the given horizontal start point in the new map
      Parameters:
      x - horizontal start point
    • playMusic

      public void playMusic()
      Play the regular map bgm
    • playitemMusic

      public static void playitemMusic()
    • playpickupMusic

      public static void playpickupMusic()
    • playNewMapMusic

      public void playNewMapMusic()
      Play the new map bgm
    • stopMusic

      public void stopMusic()
      Stop the regular map bgm
    • stopNewMapMusic

      public void stopNewMapMusic()
      Stop the new map bgm
    • dispose

      public void dispose()
      Description copied from class: GameArea
      Dispose of all internal entities in the area
      Specified by:
      dispose in interface Disposable
      Overrides:
      dispose in class GameArea