de.htwdd.rosenkoenig.gui.genuts
Class Knights

java.lang.Object
  extended by com.genuts.gameui.Sprite
      extended by com.genuts.gameui.SpriteWrapper
          extended by 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.


Field Summary
private  Game game
           
private  java.util.EnumMap<ImageState,java.awt.Image> images
           
private  ImageSequenceSprite knight
           
private  Sprite selection
           
private  ImageState state
           
 
Constructor Summary
Knights(Color player, Game game, PlayField playfield)
          Creates a new set of knights for the specified player, initially containing four knights.
 
Method Summary
 void click(java.awt.event.MouseEvent event)
          toggle knights
 void setKnights(int numKnights)
          changes the number of playable knights.
 void setKnightState(ImageState state)
          changes the set's state
 boolean setPosition(int x, int y)
           
 
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 com.genuts.gameui.Sprite
getFinalWrapper, getWrapper, setWrapper, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

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 knights
game - owning game
playfield - parent playfield
Method Detail

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