Genuts ME API

com.genuts.gameui
Class MovingPrecisionSpriteWrapper

java.lang.Object
  extended bycom.genuts.gameui.Sprite
      extended bycom.genuts.gameui.SpriteWrapper
          extended bycom.genuts.gameui.MovingSpriteWrapper
              extended bycom.genuts.gameui.MovingPrecisionSpriteWrapper
All Implemented Interfaces:
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 (int type) for x and y coordinates.

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

Constructor Summary
MovingPrecisionSpriteWrapper(Sprite sprite)
          Initializes the moving precision sprite with an action sprite.
 
Method Summary
 int getPrecision()
          Gets the precision value of the object.
 int getPrecisionX()
          Gets the X position of the action sprite in the playfield with int type value.
 int getPrecisionY()
          Gets the Y position of the action sprite in the playfield with int 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.
 void setPrecision(int p)
          Sets the precision value of the object.
 boolean setPrecisionPosition(int x, int y)
          Sets the position of the action sprite in the playfield with int type values.
 
Methods inherited from class com.genuts.gameui.MovingSpriteWrapper
move, tick
 
Methods inherited from class com.genuts.gameui.SpriteWrapper
checkCollision, collisionWith, getActionSprite, getBackground, getBottomCollisionOffset, getFinalActionSprite, getHeight, getId, getImage, getLeftCollisionOffset, getParent, getRightCollisionOffset, getTopCollisionOffset, getWidth, getX, getY, invalidate, isBackgroundSprite, isPremode, isSpriteAt, isValidate, isVisible, paint, preCollisionWith, repaint, setBackground, setBackgroundSprite, setBottomCollisionOffset, 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(int x,
                                    int y)
Sets the position of the action sprite in the playfield with int 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 int getPrecisionX()
Gets the X position of the action sprite in the playfield with int type value.

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

getPrecisionY

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

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

getPrecision

public int getPrecision()
Gets the precision value of the object.
By default the value is 1000.

Returns:
The precision value of the object.

setPrecision

public void setPrecision(int p)
Sets the precision value of the object.
By default the value is 1000.

Parameters:
p - The precision value of the object

Genuts ME API

Genuts ME API