|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectse.liu.student.kimgr905.tilegame.sprites.Sprite
se.liu.student.kimgr905.tilegame.sprites.Ship
se.liu.student.kimgr905.tilegame.sprites.Player
public final class Player
The Player
| Field Summary | |
|---|---|
private int |
ammo
|
private static int |
AMMO_DOUBLE
|
private int |
currentWeapon
|
static float |
DOBULE_X1
Left double lazer x-position. |
static float |
DOBULE_X2
Right double lazer x-position. |
static int |
DOUBLE_LAZER
Double lazer. |
static float |
DOUBLE_Y
Double lazer y-position. |
private static int |
HIT_POINTS
|
private static int |
KNOCKBACK
|
private static float |
MAX_SPEED
|
private static int |
SHIELD_POINTS
|
private int |
shieldPoints
|
static int |
SINGLE_LAZER
Single lazer. |
static float |
SINGLE_X
Single lazer x-position. |
static float |
SINGLE_Y
Single lazer y-position. |
| Fields inherited from class se.liu.student.kimgr905.tilegame.sprites.Sprite |
|---|
anim, STATE_DEAD, STATE_EXPLODING, STATE_NORMAL, STATE_SHOOTING |
| Constructor Summary | |
|---|---|
Player(Animation normal,
Animation exploding)
Creates a player ship with the specified animations. |
|
| Method Summary | |
|---|---|
int |
getAmmo()
Returns the ammo of DOUBLE_LAZER. |
int |
getMaxAmmo()
Returns max ammo of DOUBLE_LAZER. |
int |
getMaxHitPoints()
Returns the maximum hitpoints of the player. |
float |
getMaxSpeed()
Returns the max speed of the player. |
int |
getShieldPoints()
Returns the current shield points. |
int |
getWeapon()
Gets the current weapon, it can either be SINGLE_LAZER or DOUBLE_LAZER. |
void |
hit()
When the player gets hit by an enemy or enemyshot, if he has shieldpoints that will be reduced otherwise he loses hitpoints. |
int |
playerKnockbackHorizontal(Sprite collisionSprite)
Returns how much the player gets knocked back at a collision, on the x-axis. |
int |
playerKnockbackVertical(Sprite collisionSprite)
Returns how much the player gets knocked back at a collision, on the y-axis. |
void |
setShield()
Enable the shield for the player, setting the variable shieldPoints to SHIELD_POINTS |
private void |
setShieldPoints(int shieldPoints)
|
void |
setWeapon(int newWeapon)
Sets a new weapon for the player. |
void |
shoot()
Decreases ammo, sets back to standard weapon when the player is out of ammo and also signals that the player is done shooting. |
| Methods inherited from class se.liu.student.kimgr905.tilegame.sprites.Ship |
|---|
changePath, changePath, clone, getHitPoints, isAwake, setHitPoints, setState, update, wakeUp |
| Methods inherited from class se.liu.student.kimgr905.tilegame.sprites.Sprite |
|---|
getHeight, getImage, getState, getVelocityX, getVelocityY, getWidth, getX, getY, isAlive, setVelocityX, setVelocityY, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int HIT_POINTS
private static final int SHIELD_POINTS
private static final float MAX_SPEED
private static final int KNOCKBACK
public static final int SINGLE_LAZER
public static final int DOUBLE_LAZER
private static final int AMMO_DOUBLE
public static final float SINGLE_X
public static final float SINGLE_Y
public static final float DOBULE_X1
public static final float DOBULE_X2
public static final float DOUBLE_Y
private int shieldPoints
private int currentWeapon
private int ammo
| Constructor Detail |
|---|
public Player(Animation normal,
Animation exploding)
normal - normal animationexploding - exploding animation| Method Detail |
|---|
public float getMaxSpeed()
public int getMaxHitPoints()
public int getShieldPoints()
private void setShieldPoints(int shieldPoints)
public void setShield()
public int getAmmo()
public int getMaxAmmo()
public void hit()
hit in class Shippublic void setWeapon(int newWeapon)
newWeapon - a new weapon for the playerpublic int getWeapon()
public void shoot()
shoot in class Shippublic int playerKnockbackVertical(Sprite collisionSprite)
collisionSprite - colliding sprite
public int playerKnockbackHorizontal(Sprite collisionSprite)
collisionSprite - colliding sprite
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||