|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdata.GameEntity
data.Player
public class Player
| Field Summary | |
|---|---|
private boolean |
chainSting
|
private long |
frameDuration
Frame duration in milliseconds since GameEngine works in terms of milliseconds |
private int |
frameNumber
The current frame |
private Sprite[] |
framesLeft
Animation frames |
private Sprite[] |
framesRight
Animation frames |
private long |
invincibility
If player take a shield bonus, s/he will be invincible to the balloon collisions. |
private boolean |
invincible
These variables are in boolean format and they represent and activate the bonuses that player takes during gameplay. |
private long |
lastFrameChange
Time from the last frame change |
private boolean |
left
If player is supposed to go to left. |
private int |
lives
Number of lives of a player. |
private boolean |
multipleStings
|
private boolean |
resurrect
If player entered a resurrection state, which is when player got shot by a balloon and still has lives before game over. |
private long |
resurrection
Resurrection state time. |
private boolean |
right
If player is supposed to go to right. |
private int |
score
Score of the player. |
private Sprite |
shield
To draw the shield bonus when taken, it is created here. |
private int |
stingSize
How many sting one player has shot. |
private boolean |
timeStop
|
| Fields inherited from class data.GameEntity |
|---|
dx, dy, ge, sm, sprite, x, y |
| Constructor Summary | |
|---|---|
Player(GameEngine ge,
java.lang.String file,
int x,
int y,
ScreenManager sm,
java.lang.String playerFolder)
Player Entity object is created. |
|
| Method Summary | |
|---|---|
void |
addLives(int x)
When player gets a life bonus his/her life will be increased. |
void |
addScore(int x)
Adds score to player. |
void |
collidedWith(GameEntity entity)
When player collides with a Balloon
s/he enters a respawn state unless s/he has 0 lives. |
void |
draw(java.awt.Graphics2D g)
If player has the shield bonus, this method will also draw a shield around player. |
void |
fire()
Player attemts to shoot a Sting |
int |
getLives()
Number of lives of player. |
int |
getScore()
|
void |
initialize()
|
boolean |
isChainSting()
|
boolean |
isInvincible()
|
boolean |
isMultipleStings()
|
boolean |
isResurrect()
|
boolean |
isTimeStop()
|
void |
move(long delta)
This method is heavily overriden as animation frames are also changing when player moves. |
long |
resurrection()
|
void |
setChainSting(boolean chainSting)
|
void |
setInvincible(boolean invincible)
|
void |
setLeft(boolean left)
|
void |
setMultipleStings(boolean multipleStings)
|
void |
setResurrect(boolean resurrect)
|
void |
setRight(boolean right)
|
void |
setTimeStop(boolean timeStop)
|
void |
setX(int x)
|
void |
stingVanished()
|
| Methods inherited from class data.GameEntity |
|---|
collidesWith, getX, getY |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Sprite[] framesRight
private Sprite[] framesLeft
private long lastFrameChange
private long frameDuration
private int frameNumber
private Sprite shield
private boolean right
private boolean left
private int stingSize
private int lives
private int score
private boolean resurrect
private long resurrection
private long invincibility
private boolean invincible
private boolean timeStop
private boolean multipleStings
private boolean chainSting
| Constructor Detail |
|---|
public Player(GameEngine ge,
java.lang.String file,
int x,
int y,
ScreenManager sm,
java.lang.String playerFolder)
ge - file - x - y - sm - playerFolder - | Method Detail |
|---|
public void move(long delta)
move in class GameEntitydelta - is the amount of time that entity will move.public void fire()
Sting
public void collidedWith(GameEntity entity)
Balloon
s/he enters a respawn state unless s/he has 0 lives.
collidedWith in class GameEntitypublic void draw(java.awt.Graphics2D g)
draw in class GameEntityg - A Graphics2D object coming from GameEnginepublic int getLives()
public void addLives(int x)
x - to set the life player will receiver.public void addScore(int x)
x - quantity of score.public boolean isInvincible()
public boolean isTimeStop()
public boolean isMultipleStings()
public boolean isChainSting()
public void setInvincible(boolean invincible)
public void setTimeStop(boolean timeStop)
public void setMultipleStings(boolean multipleStings)
public void setChainSting(boolean chainSting)
public int getScore()
public void setX(int x)
public void setRight(boolean right)
public void setLeft(boolean left)
public void stingVanished()
public void initialize()
public boolean isResurrect()
public void setResurrect(boolean resurrect)
public long resurrection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||