public class Player
Represents a player who has joined the game
Constructor and Description |
---|
Player(InputDevice input,
java.lang.String name,
com.badlogic.gdx.graphics.Color color,
com.badlogic.gdx.graphics.Color color2)
Represents a player who has joined the game
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Player other)
Compares players to see who has highest score
|
com.badlogic.gdx.graphics.Color |
getColor()
A custom colour chosen by player in options
|
com.badlogic.gdx.graphics.Color |
getColor2() |
int |
getDeaths()
If your game tracks lives, you can store how many times the player has died here
(rather than lives remaining)
|
float |
getHealthLost()
If your game tracks health, you can store how much health the player has lost here
(rather than storing the remaining health)
|
InputDevice |
getInput()
The keyboard/controller etc he is using
|
int |
getMetaScore()
When game is part of a multi-round tournment this represents the overall score in
the tournament
|
java.lang.String |
getName()
The name to display for this player.
|
int |
getScore()
If your game keeps score you can store it here
|
float |
getStartingHealth()
How much health the player started with
|
java.lang.String |
healthDisplayString(float startingHealth) |
void |
incMetaScore(int i) |
boolean |
isOutOfLives(int lives)
Gameover, man, gameover.
|
java.lang.String |
livesDisplayString(int startingLives) |
void |
reset()
Resets score, lives and health for a new round
|
void |
setDeaths(int p)
If your game tracks lives, you can store how many times the player has died here
(rather than lives remaining)
|
void |
setHealthLost(float p)
If your game tracks health, you can store how much health the player has lost here
(rather than storing the remaining health)
|
void |
setScore(int p)
If your game keeps score you can store it here
|
void |
setStartingHealth(float p)
How much health the player started with
|
public Player(InputDevice input, java.lang.String name, com.badlogic.gdx.graphics.Color color, com.badlogic.gdx.graphics.Color color2)
Represents a player who has joined the game
input
- The keyboard/controller etc he is usingname
- The name to display for this player. Defaults to 'PLAYERx' but may be customized in optionscolor
- A custom colour chosen by player in optionsinput
- The keyboard/controller etc he is usingname
- The name to display for this player. Defaults to 'PLAYERx' but may be customized in optionscolor
- A custom colour chosen by player in optionscolor
- Another custom colourpublic int compareTo(Player other)
Compares players to see who has highest score
public int getScore()
If your game keeps score you can store it here
public void setScore(int p)
If your game keeps score you can store it here
public int getDeaths()
If your game tracks lives, you can store how many times the player has died here (rather than lives remaining)
public void setDeaths(int p)
If your game tracks lives, you can store how many times the player has died here (rather than lives remaining)
public float getHealthLost()
If your game tracks health, you can store how much health the player has lost here (rather than storing the remaining health)
public void setHealthLost(float p)
If your game tracks health, you can store how much health the player has lost here (rather than storing the remaining health)
public int getMetaScore()
When game is part of a multi-round tournment this represents the overall score in the tournament
public void incMetaScore(int i)
public float getStartingHealth()
How much health the player started with
public void setStartingHealth(float p)
How much health the player started with
public java.lang.String healthDisplayString(float startingHealth)
public java.lang.String livesDisplayString(int startingLives)
public boolean isOutOfLives(int lives)
Gameover, man, gameover.
public void reset()
Resets score, lives and health for a new round
public InputDevice getInput()
The keyboard/controller etc he is using
public java.lang.String getName()
The name to display for this player.
Defaults to 'PLAYERx' but may be customized in options
public com.badlogic.gdx.graphics.Color getColor()
A custom colour chosen by player in options
public com.badlogic.gdx.graphics.Color getColor2()