|
||||||||||
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.ToTile4Movement
org.deken.game.movement.FourKeyToTile4Movement
public class FourKeyToTile4Movement
Title: FourKeyToTileMovement
Description: Maps four keyboard keys to the Cardinal directions (north, south, east west), and move the Actor to the next tile when pressed.
Copyright: Copyright (c) Mar 5, 2012
Field Summary | |
---|---|
protected KeyDirectionAction[] |
keyDirectionActions
|
protected int[] |
keyIDs
|
Fields inherited from class org.deken.game.movement.ToTile4Movement |
---|
currentXTile, currentYTile, mapSize, movingToTile, parent, running, speed, targetX, targetXTile, targetY, targetYTile |
Fields inherited from class org.deken.game.movement.BaseMovement |
---|
gameVector, name |
Constructor Summary | |
---|---|
FourKeyToTile4Movement()
KeyMovement |
|
FourKeyToTile4Movement(int upKeyID,
int downKeyID,
int rightKeyID,
int leftKeyID,
MapSize mapSize,
Actor parent)
Creates a FourKeyMovement with the key IDs for the four cardinal directions, using the MapSize to determine if at tile, and Actor for current location. |
Method Summary | |
---|---|
void |
addInputAction(InputAction inputAction)
add an InputAction for monitoring. |
protected void |
checkReverseDirection()
This method must be over-ridden if the implementing class can reverse, direction when moving between tiles. |
FourKeyToTile4Movement |
copy(Actor actor)
Copies this movement |
protected GameVector.DIRECTION |
getDirectionEnum()
|
int[] |
getInputActionIds()
Gets the Key IDs. |
KeyDirectionAction[] |
getKeyDirectionActions()
This methods returns the list of KeyDirectionActions for this KeyMovement. |
protected boolean |
isKeyInputConflicting()
|
void |
locationUpdated()
|
protected void |
markTileReached()
|
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 |
update(long elapseTime)
This identifies which key was pressed or released. |
Methods inherited from class org.deken.game.movement.ToTile4Movement |
---|
collideHorizontal, collideLayer, collideVertical, copyBase, getXUpdate, getYUpdate, isMovingToTile, reset, setRunning, setSpeed, setTargetTile |
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.KeyMovement |
---|
setSpeed |
Methods inherited from interface org.deken.game.movement.Movement |
---|
collideHorizontal, collideLayer, collideVertical, getDirection, getGameVector, getXUpdate, getYUpdate |
Methods inherited from interface org.deken.game.Updateable |
---|
getName |
Field Detail |
---|
protected int[] keyIDs
protected KeyDirectionAction[] keyDirectionActions
Constructor Detail |
---|
public FourKeyToTile4Movement()
public FourKeyToTile4Movement(int upKeyID, int downKeyID, int rightKeyID, int leftKeyID, MapSize mapSize, Actor parent)
upKeyID
- downKeyID
- rightKeyID
- leftKeyID
- mapSize
- parent
- Method Detail |
---|
public void addInputAction(InputAction inputAction)
InputListener
addInputAction
in interface InputListener
public FourKeyToTile4Movement copy(Actor actor)
copy
in interface Movement
public int[] getInputActionIds()
InputListener
getInputActionIds
in interface InputListener
public KeyDirectionAction[] getKeyDirectionActions()
KeyMovement
getKeyDirectionActions
in interface KeyMovement
public void locationUpdated()
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 update(long elapseTime)
update
in interface Movement
update
in interface Updateable
update
in class ToTile4Movement
elapseTime
- protected void checkReverseDirection()
ToTile4Movement
checkReverseDirection
in class ToTile4Movement
protected void markTileReached()
markTileReached
in class ToTile4Movement
protected GameVector.DIRECTION getDirectionEnum()
getDirectionEnum
in class ToTile4Movement
protected boolean isKeyInputConflicting()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |