org.deken.game.movement
Class MouseDragMovement

java.lang.Object
  extended by org.deken.game.movement.BaseMovement
      extended by org.deken.game.movement.MouseDragMovement
All Implemented Interfaces:
InputMouseListener, MouseMovement, Movement, Updateable

public class MouseDragMovement
extends BaseMovement
implements MouseMovement

Title: MouseDragMovement

Description: This class is for creating a game pieces that is moved only directly clicking on the piece and dragging the mouse.

Copyright (c) 2007

Version:
1.0
Author:
Gary Deken

Field Summary
static int BUTTON_ACTION
           
static int MOTION_ACTION
           
protected  int xOffSet
           
protected  int yOffSet
           
 
Fields inherited from class org.deken.game.movement.BaseMovement
gameVector, name
 
Constructor Summary
protected MouseDragMovement()
           
  MouseDragMovement(GameLocation gameLocation, SpriteSize size, InputMouseAction mouseClick, InputMouseAction mouseMove)
          MouseDragMovement
 
Method Summary
 void addInputMouseAction(InputMouseAction inputMouseAction, int action)
          addInputAction This method add an InputMouseAction to the MouseMovement, for the action.
 void collideHorizontal()
          Adjust the horizontal (x axis) movement to a collision.
 void collideLayer()
          Adjust the layer (z axis) movement to a collision.
 void collideVertical()
          Adjust the vertical (y axis) movement to a collision.
 MouseDragMovement copy(Actor actor)
          Copies this movement
 java.awt.geom.Rectangle2D getBounds()
           
 InputMouseAction[] getInputMouseActions()
          getInputMouseActions This methods returns the list of InputMouseActions for this MouseMovement.
 java.lang.String getName()
           
 double getSpeed()
           
 double getXUpdate()
          This returns the amount of X movement for a given update.
 double getYUpdate()
          This returns the amount of Y movement for a given update.
 void notifyListener(InputMouseAction inputMouseAction)
          notifyListener
 void setBounds(int x, int y, int width, int height)
           
 void setGameLocation(GameLocation gameLocation)
           
 void setRunning(boolean running)
           
 void setSpeed(double speed)
           
 void update(long elapseTime)
          This method takes the elapse time, since the last update, and to determine the next movement to set to the GameVector.
 
Methods inherited from class org.deken.game.movement.BaseMovement
baseCopy, getDirection, getGameVector, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deken.game.movement.Movement
getDirection, getGameVector
 

Field Detail

BUTTON_ACTION

public static final int BUTTON_ACTION
See Also:
Constant Field Values

MOTION_ACTION

public static final int MOTION_ACTION
See Also:
Constant Field Values

xOffSet

protected int xOffSet

yOffSet

protected int yOffSet
Constructor Detail

MouseDragMovement

public MouseDragMovement(GameLocation gameLocation,
                         SpriteSize size,
                         InputMouseAction mouseClick,
                         InputMouseAction mouseMove)
MouseDragMovement

Parameters:
gameLocation - int
size - int
mouseClick - InputMouseAction
mouseMove - InputMouseAction

MouseDragMovement

protected MouseDragMovement()
Method Detail

addInputMouseAction

public void addInputMouseAction(InputMouseAction inputMouseAction,
                                int action)
Description copied from interface: MouseMovement
addInputAction This method add an InputMouseAction to the MouseMovement, for the action.

Specified by:
addInputMouseAction in interface MouseMovement
Parameters:
inputMouseAction - InputMouseAction
action - int

collideHorizontal

public void collideHorizontal()
Adjust the horizontal (x axis) movement to a collision.

Specified by:
collideHorizontal in interface Movement

collideVertical

public void collideVertical()
Adjust the vertical (y axis) movement to a collision.

Specified by:
collideVertical in interface Movement

collideLayer

public void collideLayer()
Adjust the layer (z axis) movement to a collision.

Specified by:
collideLayer in interface Movement

copy

public MouseDragMovement copy(Actor actor)
Copies this movement

Specified by:
copy in interface Movement
Returns:
Movement

getBounds

public java.awt.geom.Rectangle2D getBounds()
Returns:
Rectangle2D

getInputMouseActions

public InputMouseAction[] getInputMouseActions()
Description copied from interface: MouseMovement
getInputMouseActions This methods returns the list of InputMouseActions for this MouseMovement.

Specified by:
getInputMouseActions in interface MouseMovement
Returns:
InputMouseAction[]

getName

public java.lang.String getName()
Specified by:
getName in interface Updateable
Overrides:
getName in class BaseMovement
Returns:

getSpeed

public double getSpeed()
Returns:
double

getXUpdate

public double getXUpdate()
Description copied from interface: Movement
This returns the amount of X movement for a given update.

Specified by:
getXUpdate in interface Movement
Returns:
double

getYUpdate

public double getYUpdate()
Description copied from interface: Movement
This returns the amount of Y movement for a given update.

Specified by:
getYUpdate in interface Movement
Returns:
double

notifyListener

public void notifyListener(InputMouseAction inputMouseAction)
Description copied from interface: InputMouseListener
notifyListener

This method is called when any Mouse Motion event occurs.

Specified by:
notifyListener in interface InputMouseListener
Parameters:
inputMouseAction - InputMouseAction

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Parameters:
x - int
y - int
width - int
height - int

setGameLocation

public void setGameLocation(GameLocation gameLocation)
Parameters:
gameLocation - GameLocation

setRunning

public void setRunning(boolean running)

setSpeed

public void setSpeed(double speed)

update

public void update(long elapseTime)
Description copied from interface: Movement
This method takes the elapse time, since the last update, and to determine the next movement to set to the GameVector.

Specified by:
update in interface Movement
Specified by:
update in interface Updateable
Parameters:
elapseTime - long