public class SimpleMover extends QuickEntity implements KeyListener
| Modifier and Type | Field and Description |
|---|---|
protected Key |
backKey |
protected Key |
forwardKey |
protected Key |
leftKey |
protected Key |
rightKey |
protected float |
speed |
engine, name, NAME_UNTITLED_ENTITY, parent| Constructor and Description |
|---|
SimpleMover(float speed)
Initialize a SimpleMover with the default key binding
|
SimpleMover(float speed,
Key forwardKey,
Key backKey,
Key leftKey,
Key rightKey)
Initialize a SimpleMover with a specific key binding
|
| Modifier and Type | Method and Description |
|---|---|
void |
attached()
Called when an Entity gets attached to an scenegraph
|
protected void |
move(Vector3f amount)
Moves this node by the amount vector
|
protected void |
move(Vector3f dir,
float amt)
Moves this node by amt into dir
|
void |
onAction(KeyEvent event)
When the trigger as triggered.
|
protected void |
registerListener() |
boxed, getTransform, removed, render, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, setEngine, setParentgetEngine, setEngineprotected float speed
protected Key forwardKey
protected Key backKey
protected Key leftKey
protected Key rightKey
public SimpleMover(float speed)
speed - The movement speedpublic SimpleMover(float speed,
Key forwardKey,
Key backKey,
Key leftKey,
Key rightKey)
speed - The movement speedforwardKey - The key to move forwardbackKey - The key to move backwardsleftKey - The key to move leftrightKey - The key to move rightpublic void attached()
Entityattached in interface Entityattached in class QuickEntityEntity.attached()protected void registerListener()
protected void move(Vector3f dir, float amt)
dir - The direction to move inamt - The amountprotected void move(Vector3f amount)
amount - The direction and amount to move inpublic void onAction(KeyEvent event)
KeyListeneronAction in interface KeyListenerevent - The KeyEventCopyright © 2014. All rights reserved.