public class GameScreen extends Screen
Modifier and Type | Class and Description |
---|---|
(package private) static class |
GameScreen.FightState
This describes the state of the fight
|
(package private) static class |
GameScreen.GameState
This is describing the state that the game is on
|
Modifier and Type | Field and Description |
---|---|
(package private) float |
attackFrame |
(package private) int |
BGposX |
(package private) int |
BGposY |
(package private) int |
currentColumn |
(package private) Pixmap |
currentPlayerPixmap |
(package private) int |
currentRow |
(package private) float |
fightFrame |
(package private) GameScreen.FightState |
fightState |
(package private) GameScreen.GameState |
gameState |
(package private) int |
grassesUntilAttack |
(package private) Enemies |
newEnemy |
(package private) java.util.Random |
randomGEN |
(package private) World |
world |
Constructor and Description |
---|
GameScreen(Game game)
Constructor which initialise the main game screen and the object instance world
|
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
private void |
drawGameOverUI(Graphics g) |
private void |
drawGrassAndPlayer()
In this method the grass and the player is drawn.
|
private void |
drawPausedUI() |
private void |
drawRunningUI()
This is responsible for drawing the User Interface of the game
|
private void |
drawTextOnFight(Graphics g)
This method is responsible drawing all the text that is happening on the fight screen
|
private void |
grassAnimation()
This method is used inside the main update method of the game, in order to produce the animation of the grass only when player walk on the grass
|
void |
pause() |
void |
present(float deltaTime) |
private void |
rest()
A very simple method that reset the player's health point back to its maximum value
|
void |
resume() |
void |
update(float deltaTime) |
private void |
updateGameOver(java.util.List<Input.TouchEvent> touchEvents)
A game over screen which is using user input in order to restart the game
|
private void |
updateGrass()
In this method, the position of the grass are updated in order to be visible after scrolling the background.
|
private void |
updatePaused(java.util.List<Input.TouchEvent> touchEvents)
A method that pause and resume the game using user input
|
private void |
updatePlayerFight(java.util.List<Input.TouchEvent> touchEvents)
This method handles all the parts of the fight that has to do with the player.
|
private void |
updateRunning(float deltaTime,
java.util.List<Input.TouchEvent> touchEvents)
This is one of the most important method of this program, it does moderate the moving and the walking animation of the character.
|
GameScreen.GameState gameState
GameScreen.FightState fightState
World world
Enemies newEnemy
int BGposX
int BGposY
int currentColumn
int currentRow
float attackFrame
float fightFrame
Pixmap currentPlayerPixmap
java.util.Random randomGEN
int grassesUntilAttack
public GameScreen(Game game)
private void grassAnimation()
private void updateRunning(float deltaTime, java.util.List<Input.TouchEvent> touchEvents)
private void rest()
private void updateGrass()
private void updatePaused(java.util.List<Input.TouchEvent> touchEvents)
private void updateGameOver(java.util.List<Input.TouchEvent> touchEvents)
private void updatePlayerFight(java.util.List<Input.TouchEvent> touchEvents)
private void drawTextOnFight(Graphics g)
private void drawGrassAndPlayer()
private void drawRunningUI()
private void drawPausedUI()
private void drawGameOverUI(Graphics g)