|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deken.game.movement.BaseMovement
org.deken.game.movement.FourKeyMovement
public class FourKeyMovement
Title: Key Movement
Description: Animates a character based on key movements.
Copyright: Copyright (c) 2006
Field Summary | |
---|---|
protected double |
currentXMovement
|
protected double |
currentYMovement
|
protected KeyDirectionAction[] |
keyDirectionActions
|
protected int[] |
keyIDs
|
protected double |
speed
|
Fields inherited from class org.deken.game.movement.BaseMovement |
---|
gameVector, name |
Constructor Summary | |
---|---|
FourKeyMovement()
KeyMovement |
|
FourKeyMovement(int upKeyID,
int downKeyID,
int rightKeyID,
int leftKeyID)
Creates a FourKeyMovement with the key IDs for the four cardinal directions. |
Method Summary | |
---|---|
void |
addInputAction(InputAction inputAction)
add an InputAction for monitoring. |
void |
collideHorizontal()
collideHorizontal Adjust the horizontal (x axis) movement to a collision. |
void |
collideLayer()
collideLayer Adjust the layer (z axis) movement to a collision. |
void |
collideVertical()
collideVertical Adjust the vertical (y axis) movement to a collision. |
FourKeyMovement |
copy(Actor actor)
Copies this movement |
int[] |
getInputActionIds()
Gets the Key IDs. |
KeyDirectionAction[] |
getKeyDirectionActions()
This methods returns the list of KeyDirectionActions for this KeyMovement. |
java.lang.String |
getName()
|
double |
getSpeed()
|
double |
getXUpdate()
This returns the movement in the X direction since the last update. |
double |
getYUpdate()
This returns the movement in the Y direction since the last update. |
void |
notifyListener(InputAction inputAction)
This method is called when any event occurs. |
void |
setKeyDirectionAction(int index,
int keyID,
float direction)
If the index is 0 or 3, set the KeyDirectionAction, with the given KeyID and Direction. |
void |
setSpeed(double speed)
Sets the speed |
void |
update(long elapseTime)
This identifies which key was pressed or released. |
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 |
---|
protected KeyDirectionAction[] keyDirectionActions
protected int[] keyIDs
protected double currentXMovement
protected double currentYMovement
protected double speed
Constructor Detail |
---|
public FourKeyMovement()
public FourKeyMovement(int upKeyID, int downKeyID, int rightKeyID, int leftKeyID)
upKeyID
- downKeyID
- rightKeyID
- leftKeyID
- Method Detail |
---|
public void addInputAction(InputAction inputAction)
InputListener
addInputAction
in interface InputListener
public void collideHorizontal()
collideHorizontal
in interface Movement
public void collideVertical()
collideVertical
in interface Movement
public void collideLayer()
collideLayer
in interface Movement
public FourKeyMovement copy(Actor actor)
copy
in interface Movement
public int[] getInputActionIds()
InputListener
getInputActionIds
in interface InputListener
public KeyDirectionAction[] getKeyDirectionActions()
KeyMovement
getKeyDirectionActions
in interface KeyMovement
public java.lang.String getName()
getName
in interface Updateable
getName
in class BaseMovement
public double getSpeed()
public double getXUpdate()
getXUpdate
in interface Movement
public double getYUpdate()
getYUpdate
in interface Movement
public void notifyListener(InputAction inputAction)
InputListener
notifyListener
in interface InputListener
inputAction
- InputActionpublic void setKeyDirectionAction(int index, int keyID, float direction)
setKeyDirectionAction
in interface KeyMovement
index
- keyID
- direction
- public void setSpeed(double speed)
KeyMovement
setSpeed
in interface KeyMovement
public void update(long elapseTime)
update
in interface Movement
update
in interface Updateable
elapseTime
- long
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |