public class MovingAvatar extends VGDLSprite
Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<Types.ACTIONS> |
actions |
java.util.ArrayList<Types.ACTIONS> |
actionsNIL |
protected boolean |
is_disqualified
Disqualified flag, moved from Game class to individual players,
as there may be more than 1 in a game; variable still in Game
class for single player games to keep back-compatibility
|
Types.MOVEMENT |
lastMovementType |
Player |
player |
autotiling, bucket, bucketSharp, color, cooldown, currentFrame, draw_arrow, frameRate, frameRemaining, friction, gravity, healthPoints, hidden, hMult, image, images, img, invisible, is_avatar, is_from_avatar, is_npc, is_oriented, is_resource, is_static, is_stochastic, isFirstTick, itypes, jump_strength, lastmove, lastrect, limitHealthPoints, mass, max_speed, maxHealthPoints, name, on_ground, only_active, orientation, orientedImg, physics, physicstype, portal, randomtiling, rect, resources, rotateInPlace, rotation, shrinkfactor, singleton, size, solid, speed, spriteID, stationary, timeToLive, wMult
Constructor and Description |
---|
MovingAvatar() |
MovingAvatar(Vector2d position,
java.awt.Dimension size,
SpriteContent cnt) |
Modifier and Type | Method and Description |
---|---|
void |
addScore(double s)
Adds a value to the current score of this player.
|
void |
applyMovement(Game game,
Direction action) |
VGDLSprite |
copy()
Creates a copy of this sprite.
|
void |
copyTo(VGDLSprite target)
Copies the attributes of this object to the one passed as parameter.
|
void |
disqualify(boolean is_disqualified)
Sets the disqualified flag.
|
KeyHandler |
getKeyHandler()
Gets the key handler of this avatar.
|
int |
getPlayerID()
Get this player's ID.
|
double |
getScore()
Gets the score of this player.
|
Types.WINNER |
getWinState()
Gets the win state of this player.
|
boolean |
is_disqualified()
Checks whether this player is disqualified.
|
protected void |
loadDefaults()
Loads the default values for this sprite.
|
void |
postProcess()
Method to perform post processing when the sprite has received its parameters.
|
protected void |
requestPlayerInput(Game game)
Requests the controller's input, setting the game.ki.action mask with the processed data.
|
void |
setKeyHandler(KeyHandler k)
Sets the key handler of this avatar.
|
void |
setPlayerID(int id)
Set this player's ID to a new value.
|
void |
setScore(double s)
Sets the score of this player to a new value.
|
void |
setWinState(Types.WINNER w)
Sets the win state of this player.
|
void |
updateAvatar(Game game,
boolean requestInput,
boolean[] actionMask)
This update call is for the game tick() loop.
|
void |
updateUse(Game game) |
_draw, _drawHealthBar, _drawImage, _drawOriented, _drawResources, _updateOrientation, _updatePos, _updateRotation, _velocity, draw, equiv, getAmountResource, getDependentSprites, getLastPosition, getPosition, getType, groundIntersects, init, intersects, is_disabled, lastDirection, loadImage, modifyResource, parseParameters, preMovement, removeResource, setDisabled, setFromAvatar, setRect, setRect, subtractResource, toString, update, updateBucket, updatePassive
public java.util.ArrayList<Types.ACTIONS> actions
public java.util.ArrayList<Types.ACTIONS> actionsNIL
public Player player
protected boolean is_disqualified
public Types.MOVEMENT lastMovementType
public MovingAvatar()
public MovingAvatar(Vector2d position, java.awt.Dimension size, SpriteContent cnt)
protected void loadDefaults()
VGDLSprite
loadDefaults
in class VGDLSprite
public void postProcess()
VGDLSprite
postProcess
in class VGDLSprite
public void updateAvatar(Game game, boolean requestInput, boolean[] actionMask)
updateAvatar
in class VGDLSprite
game
- current state of the game.protected void requestPlayerInput(Game game)
game
- public void updateUse(Game game)
public KeyHandler getKeyHandler()
public void setKeyHandler(KeyHandler k)
k
- - new KeyHandler object.public boolean is_disqualified()
public void disqualify(boolean is_disqualified)
public double getScore()
public void setScore(double s)
s
- - new score.public void addScore(double s)
s
- - value to add to the score.public Types.WINNER getWinState()
public void setWinState(Types.WINNER w)
w
- - new win state.public int getPlayerID()
public void setPlayerID(int id)
id
- - new player ID.public VGDLSprite copy()
VGDLSprite
copy
in class VGDLSprite
public void copyTo(VGDLSprite target)
VGDLSprite
copyTo
in class VGDLSprite
target
- the sprite to copy to.