Genuts API

com.genuts.gameui
Class MovingPrecisionSpriteWrapper

java.lang.Object
  |
  +--com.genuts.gameui.Sprite
        |
        +--com.genuts.gameui.SpriteWrapper
              |
              +--com.genuts.gameui.MovingSpriteWrapper
                    |
                    +--com.genuts.gameui.MovingPrecisionSpriteWrapper
All Implemented Interfaces:
java.lang.Cloneable, Tickable

public abstract class MovingPrecisionSpriteWrapper
extends MovingSpriteWrapper

Sprite wrapper with the ability to move with precision positions. This sprite wrapper is an abstract class, it can only be extended directly to define its own behavior for moving.

The goal of this wrapper is to have a precision postion (double type) for x and y coordinates.

See Also:
setPrecisionPosition(double, double), getPrecisionX(), getPrecisionY()

Constructor Summary
MovingPrecisionSpriteWrapper(Sprite sprite)
          Initializes the moving precision sprite with an action sprite.
 
Method Summary
 double getPrecisionX()
          Gets the X position of the action sprite in the playfield with double type value.
 double getPrecisionY()
          Gets the Y position of the action sprite in the playfield with double type value.
 void setActionSprite(Sprite sprite)
          Sets the action sprite.
 boolean setPosition(int x, int y)
          Sets the position of the action sprite in the playfield.
 boolean setPrecisionPosition(double x, double y)
          Sets the position of the action sprite in the playfield with double type values.
 
Methods inherited from class com.genuts.gameui.MovingSpriteWrapper
move, tick
 
Methods inherited from class com.genuts.gameui.SpriteWrapper
checkCollision, cloneSprite, collisionWith, getActionSprite, getBackground, getBottomCollisionOffset, getBounds, getFinalActionSprite, getHeight, getId, getImage, getLeftCollisionOffset, getParent, getPosition, getRightCollisionOffset, getSize, getTopCollisionOffset, getWidth, getX, getY, invalidate, isBackgroundSprite, isPremode, isSpriteAt, isValidate, isVisible, paint, preCollisionWith, repaint, setBackground, setBackgroundSprite, setBottomCollisionOffset, setBounds, setBounds, setId, setImage, setLeftCollisionOffset, setParent, setPremode, setRightCollisionOffset, setSize, setTopCollisionOffset, setVisible, 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
 

Constructor Detail

MovingPrecisionSpriteWrapper

public MovingPrecisionSpriteWrapper(Sprite sprite)
Initializes the moving precision sprite with an action sprite.

Parameters:
sprite - Action sprite
Method Detail

setActionSprite

public void setActionSprite(Sprite sprite)
Sets the action sprite.

Overrides:
setActionSprite in class SpriteWrapper
Parameters:
sprite - Action sprite.

setPosition

public boolean setPosition(int x,
                           int y)
Sets the position of the action sprite in the playfield.

Overrides:
setPosition in class SpriteWrapper
Parameters:
x - X position of the sprite.
y - Y position of the sprite.
Returns:
true if the modification was done, false otherwise.

setPrecisionPosition

public boolean setPrecisionPosition(double x,
                                    double y)
Sets the position of the action sprite in the playfield with double type values.

Parameters:
x - X position of the sprite.
y - Y position of the sprite.
Returns:
true if the modification was done, false otherwise.

getPrecisionX

public double getPrecisionX()
Gets the X position of the action sprite in the playfield with double type value.

Returns:
The X position of the action sprite in the playfield with double type value.

getPrecisionY

public double getPrecisionY()
Gets the Y position of the action sprite in the playfield with double type value.

Returns:
The Y position of the action sprite in the playfield with double type value.

Genuts API

Genuts API