de.htwdd.rosenkoenig.gui.genuts
Class Knights
java.lang.Object
com.genuts.gameui.Sprite
com.genuts.gameui.SpriteWrapper
de.htwdd.rosenkoenig.gui.genuts.Knights
- All Implemented Interfaces:
- Tickable, Clickable, java.lang.Cloneable
public class Knights
- extends SpriteWrapper
- implements Clickable
This class represents the set of knights of one player. If the player intends to use a knight in
the current turn, he has to click this element.
The knights element shows as many knights as the player has left.
|
Constructor Summary |
Knights(Color player,
Game game,
PlayField playfield)
Creates a new set of knights for the specified player, initially containing four knights. |
| Methods inherited from class com.genuts.gameui.SpriteWrapper |
checkCollision, cloneSprite, collisionWith, getActionSprite, getBackground, getBottomCollisionOffset, getBounds, getFinalActionSprite, getHeight, getId, getImage, getLeftCollisionOffset, getParent, getPosition, getRightCollisionOffset, getRotation, getSize, getTopCollisionOffset, getWidth, getX, getY, invalidate, isBackgroundSprite, isPremode, isSpriteAt, isValidate, isVisible, paint, preCollisionWith, repaint, setActionSprite, setBackground, setBackgroundSprite, setBottomCollisionOffset, setBounds, setBounds, setId, setImage, setLeftCollisionOffset, setParent, setPremode, setRightCollisionOffset, setRotation, setSize, setTopCollisionOffset, setVisible, tick, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
images
private java.util.EnumMap<ImageState,java.awt.Image> images
knight
private ImageSequenceSprite knight
selection
private Sprite selection
state
private ImageState state
game
private Game game
Knights
public Knights(Color player,
Game game,
PlayField playfield)
- Creates a new set of knights for the specified player, initially containing four knights.
- Parameters:
player - owner of the set of knightsgame - owning gameplayfield - parent playfield
setKnightState
public void setKnightState(ImageState state)
- changes the set's state
- Parameters:
state - disabled, enabled or selected
setKnights
public void setKnights(int numKnights)
- changes the number of playable knights.
- Parameters:
numKnights - number of knights left.
setPosition
public boolean setPosition(int x,
int y)
- Overrides:
setPosition in class SpriteWrapper
click
public void click(java.awt.event.MouseEvent event)
- toggle knights
- Specified by:
click in interface Clickable