|
||||||||||
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.TwoKeyMovement
public class TwoKeyMovement
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 | |
---|---|
TwoKeyMovement()
TwoKeyMovement |
|
TwoKeyMovement(int rightKeyID,
int leftKeyID)
|
Method Summary | |
---|---|
void |
addInputAction(InputAction inputAction)
add an InputAction for monitoring. |
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. |
TwoKeyMovement |
copy(Actor actor)
Copies the movement. |
int[] |
getInputActionIds()
Gets the Key IDs. |
KeyDirectionAction[] |
getKeyDirectionActions()
This methods returns the list of KeyDirectionActions for this KeyMovement. |
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 identifies which key was pressed or released. |
void |
setKeyDirectionAction(int index,
int keyID,
float direction)
If the index is 0 or 1, 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, getName, 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 |
Methods inherited from interface org.deken.game.Updateable |
---|
getName |
Field Detail |
---|
protected int[] keyIDs
protected KeyDirectionAction[] keyDirectionActions
protected double currentXMovement
protected double currentYMovement
protected double speed
Constructor Detail |
---|
public TwoKeyMovement()
public TwoKeyMovement(int rightKeyID, int leftKeyID)
rightKeyID
- KeyEventleftKeyID
- KeyEventMethod 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 TwoKeyMovement copy(Actor actor)
Movement
copy
in interface Movement
public int[] getInputActionIds()
InputListener
getInputActionIds
in interface InputListener
public KeyDirectionAction[] getKeyDirectionActions()
KeyMovement
getKeyDirectionActions
in interface KeyMovement
public double getSpeed()
public double getXUpdate()
getXUpdate
in interface Movement
public double getYUpdate()
getYUpdate
in interface Movement
public void notifyListener(InputAction inputAction)
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
speed
- doublepublic 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 |