Package hoverball

Class Human.Controls

java.lang.Object
hoverball.Human.Controls
Enclosing class:
Human

public static class Human.Controls
extends java.lang.Object
The class Human.Controls defines controls for Human units. For now, only key controls are possible.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static Human.Controls CRSR
    Default key controls: cursor keys + control + shift
  • Constructor Summary

    Constructors 
    Constructor Description
    Controls​(int forward, int back, int left, int right, int positive, int negative)
    Defines a key controls.
    Controls​(java.lang.String controls)
    Defines a key controls.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getKeyText​(int control)
    Returns a string representation of each key controls.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CRSR

      public static final Human.Controls CRSR
      Default key controls: cursor keys + control + shift
  • Constructor Details

    • Controls

      public Controls​(int forward, int back, int left, int right, int positive, int negative)
      Defines a key controls.

      The arguments correspond to the KeyEvent codes.

      Parameters:
      forward - move forward
      back - move backward
      left - turn left
      right - turn right
      positive - polarize positive
      negative - polarize negative
    • Controls

      public Controls​(java.lang.String controls)
      Defines a key controls.

      The first 6 characters of the controls string define the keys for:

      • move forward
      • move backward
      • turn left
      • turn right
      • polarize positive
      • polarize negative
      Parameters:
      controls - controls string
  • Method Details

    • getKeyText

      public java.lang.String getKeyText​(int control)
      Returns a string representation of each key controls.

      The argument control means:

      • 0 = move forward
      • 1 = move backward
      • 2 = turn left
      • 3 = turn right
      • 4 = polarize positive
      • 5 = polarize negative
      Parameters:
      control - required controls