Class ForestGameArea
- All Implemented Interfaces:
Disposable
public class ForestGameArea extends GameArea
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ForestGameArea(TerrainFactory terrainFactory)
-
Method Summary
Modifier and Type Method Description void
create()
Create the game area, including terrain, static entities (trees), dynamic entities (player)void
dispose()
Dispose of all internal entities in the areavoid
InvSys()
static void
playitemMusic()
void
playMusic()
Play the regular map bgmvoid
playNewMapMusic()
Play the new map bgmstatic void
playpickupMusic()
void
showNewMapScrollingBackground(int counter, float vertical)
Show background in the new map according to the given horizontal and vertical start pointvoid
showScrollingBackground(int counter)
Show background in the regular map according to the given countervoid
spawnFaceWorm(Vector2 position)
Generate Face Worm at current Flying Monkeys location.void
spawnFireRocksone(int xValue)
Generate line 5 rocks in the new mapvoid
spawnFireRocksthree(int xValue)
void
spawnFireRockstwo(int xValue)
Genrate large rock pyramid N NN NNN NNNNvoid
spawnFirstAid()
void
spawnFlyingMonkey()
Generate Flying Monkeys at random locations.void
spawnGoldNewMapRandomly(int x)
Generate another set of gold from the given horizontal start point in the new mapvoid
spawnInvisibleCeiling(Vector2 worldBounds, GridPoint2 tileBounds)
Generate invisible ceiling on top to avoid the character jump out of the mapvoid
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.void
spawnNailsfour(int xValue)
void
spawnNailsone(int xValue)
void
spawnNailsthree(int xValue)
void
spawnNailstwo(int xValue)
void
spawnObstacles()
Obstacles are randomly generated according to the position of the character.void
spawnPortal(Vector2 position, ObstacleEventHandler.ObstacleType type)
Generate Small Missile at Spaceship location.void
spawnRockstwo(int xValue)
Generate rocks pyramid N NN NNNvoid
spawnSmallMissile(Vector2 position)
Generate Small Missile at Spaceship location.void
spawnSpaceship()
Generate Spaceship at fixed location.void
spawnTerrain(TerrainFactory.TerrainType terrainType)
Generate the first set of terrainvoid
spawnTerrainRandomly(int xValue, TerrainFactory.TerrainType terrainType)
Generate the continuous terrain after the first set of terrainvoid
spawnWoodsfive(int xValue)
void
spawnWoodsfour(int xValue)
void
spawnWoodsone(int xValue)
void
spawnWoodsRandomly(int xValue)
Generate 5 wood randomly in the 52f and 54f height and given horizontal start pointvoid
spawnWoodsthree(int xValue)
void
spawnWoodstwo(int xValue)
void
stopMusic()
Stop the regular map bgmvoid
stopNewMapMusic()
Stop the new map bgmMethods inherited from class com.deco2800.game.areas.GameArea
spawnEntity, spawnEntityAt, spawnEntityAt
-
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) -
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 pointvertical
- change the vertical start point
-
spawnTerrain
Generate the first set of terrain- Parameters:
terrainType
- change the type of the terrain
-
spawnTerrainRandomly
Generate the continuous terrain after the first set of terrain- Parameters:
xValue
- control the position of the terrainterrainType
- change the type of the terrain
-
spawnInvisibleCeiling
Generate invisible ceiling on top to avoid the character jump out of the map- Parameters:
worldBounds
- wall position valuetileBounds
- 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
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
Generate Small Missile at Spaceship location. Called by render() in MainGameScreen.java- Parameters:
position
- the location of Spaceship
-
spawnPortal
Generate Small Missile at Spaceship location. Called by render() in MainGameScreen.java- Parameters:
position
- the location of Spaceshiptype
- 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 interfaceDisposable
- Overrides:
dispose
in classGameArea
-