de.htwdd.rosenkoenig.gui.genuts
Class Stone
java.lang.Object
com.genuts.gameui.Sprite
com.genuts.gameui.SpriteWrapper
de.htwdd.rosenkoenig.gui.genuts.Stone
- All Implemented Interfaces:
- Tickable, java.lang.Cloneable
public class Stone
- extends SpriteWrapper
This class represents a stone. Stones can be red or white, they can also be drawn "misty" to
indicate that a stone is only temporarily set to a specific position.
|
Constructor Summary |
Stone(Color color,
boolean transparent)
Creates a stone of the specified color and state. |
|
Method Summary |
static void |
init()
Forces the Stone class to load the different images needed to draw stones. |
private void |
setColor(Color color,
boolean transparent)
Defines the stone's color. |
boolean |
setPosition(int x,
int y)
Sets the stone to the specified position and adds a random variation to the position, which
makes it look more "human". |
| 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 |
posVariation
private static final int posVariation
- See Also:
- Constant Field Values
images
private static java.util.EnumMap<Color,java.awt.Image> images
imagesPerhaps
private static java.util.EnumMap<Color,java.awt.Image> imagesPerhaps
Stone
public Stone(Color color,
boolean transparent)
- Creates a stone of the specified color and state. The stone gets rotated randomly.
- Parameters:
color - transparent - if true, the stone is drawn "misty"
init
public static void init()
- Forces the Stone class to load the different images needed to draw stones. ImageList has to
be initialized before this method is called.
setColor
private void setColor(Color color,
boolean transparent)
- Defines the stone's color. The method rotates the stone randomly.
- Parameters:
color - transparent - if true, the stone is drawn "misty"
setPosition
public boolean setPosition(int x,
int y)
- Sets the stone to the specified position and adds a random variation to the position, which
makes it look more "human".
- Overrides:
setPosition in class SpriteWrapper
- Parameters:
x - x positiony - y position