de.htwdd.rosenkoenig.gui.genuts
Class Stone

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


Field Summary
private static java.util.EnumMap<Color,java.awt.Image> images
           
private static java.util.EnumMap<Color,java.awt.Image> imagesPerhaps
           
private static int posVariation
           
 
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 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

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

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"
Method Detail

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 position
y - y position