public class PlayerInputHandler extends java.lang.Object implements InputComponent, Observer<InputEvent>
Constructor and Description |
---|
PlayerInputHandler()
creates a new input handler, adds itself as observer to the game which receives input from the user
|
Modifier and Type | Method and Description |
---|---|
void |
handleInput(GameObject object)
makes the players avatar move left/right when the device is tilted a certain amount,
jump when the left half of the screen is touched and attack if the right half is touched
|
void |
onNotify(InputEvent event)
is called when an input event is recorded
|
public PlayerInputHandler()
public void handleInput(GameObject object)
handleInput
in interface InputComponent
object
- the player object that should receive the users inputpublic void onNotify(InputEvent event)
onNotify
in interface Observer<InputEvent>
event
- the user input