de.htwdd.rosenkoenig.gui.genuts
Class DrawDeck
java.lang.Object
com.genuts.gameui.Sprite
com.genuts.gameui.SpriteWrapper
de.htwdd.rosenkoenig.gui.genuts.DrawDeck
- All Implemented Interfaces:
- Tickable, Clickable, java.lang.Cloneable
public class DrawDeck
- extends SpriteWrapper
- implements Clickable
This class represents the draw deck. Whenever the user intends to draw a card, he has to click
the draw deck. The draw deck shows a red cross if it is empty, a click forces the game to shuffle
the cards and refill the deck.
|
Method Summary |
void |
click(java.awt.event.MouseEvent event)
draw a card |
void |
setDrawDeck(int numCards)
Sets the number of cards left in the deck. |
boolean |
setPosition(int x,
int y)
|
void |
setState(ImageState state)
Sets the deck's state. |
| 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
deck
private ImageSequenceSprite deck
state
private ImageState state
selection
private Sprite selection
game
private Game game
DrawDeck
public DrawDeck(Game game,
PlayField playfield)
- Creates a new DrawDeck.
- Parameters:
game - the game this deck belongs toplayfield - the parent playfield
setDrawDeck
public void setDrawDeck(int numCards)
- Sets the number of cards left in the deck.
- Parameters:
numCards - number of cards
setState
public void setState(ImageState state)
- Sets the deck's state.
- Parameters:
state - enabled or disabled
setPosition
public boolean setPosition(int x,
int y)
- Overrides:
setPosition in class SpriteWrapper
click
public void click(java.awt.event.MouseEvent event)
- draw a card
- Specified by:
click in interface Clickable