Class Human
public class Human extends Unit
For this purpose, you need a key controls that can be defined by the class Human.Controls.
The key input is enabled if the main panel of the human hovlet or the Controller's screen is active. (Of course, the latter works only if the Human unit and the Controller are running on the same Java instance.)
The class Human can also be executed as an application:
java hoverball.Human [team [name [color] [host][:port][#hash] ]]
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Human.Controls
The class Human.Controls defines controls for Human units. -
Field Summary
Fields Modifier and Type Field Description static java.awt.event.KeyListener
listener
KeyListener object for all Human unitsFields inherited from class hoverball.Unit
BALL, channel_n, channel_t, energy, NODE, penalty, pucks, self, time, UNIT
Fields inherited from class hoverball.Hovlet
background, BANNER, foreground, hovlets, icon, main, menubar, parent, title
-
Constructor Summary
Constructors Constructor Description Human()
Opens a Human unit with CRSR controls.Human(java.lang.String name)
Opens a Human unit with CRSR controls.Human(java.lang.String name, int color)
Opens a Human unit with CRSR controls.Human(java.lang.String team, java.lang.String name)
Opens a Human unit with CRSR controls.Human(java.lang.String team, java.lang.String name, int color)
Opens a Human unit with CRSR controls.Human(java.lang.String team, java.lang.String name, int color, Human.Controls controls)
Opens a Human unit with indicated controls. -
Method Summary
Methods inherited from class hoverball.Unit
action, action, action, connecting, debug, debug, disconnecting, format, format, format, format, look, option, puck, puck
-
Field Details
-
listener
public static final java.awt.event.KeyListener listenerKeyListener object for all Human units
-
-
Constructor Details
-
Human
public Human()Opens a Human unit with CRSR controls. -
Human
public Human(java.lang.String name)Opens a Human unit with CRSR controls.- Parameters:
name
- unit name
-
Human
public Human(java.lang.String team, java.lang.String name)Opens a Human unit with CRSR controls.- Parameters:
team
- team namename
- unit name
-
Human
public Human(java.lang.String name, int color)Opens a Human unit with CRSR controls.- Parameters:
name
- unit namecolor
- color
-
Human
public Human(java.lang.String team, java.lang.String name, int color)Opens a Human unit with CRSR controls.- Parameters:
team
- team namename
- unit namecolor
- color
-
Human
Opens a Human unit with indicated controls.- Parameters:
team
- team namename
- unit namecolor
- colorcontrols
- controls
-
-
Method Details
-
main
public static void main(java.lang.String[] args)Executes a Human unit (application!). -
assign
Assigns a controls to a unit.The assignment makes the unit send corresponding actions on keypress. By this method, Human units automatically assign their controls on call.
If
controls
equalsnull
, the assignment for this unit is canceled.- Parameters:
unit
- unitcontrols
- controls
-
untype
public static final void untype()Imitates the release of all keys.This method should be called if an AWT component, on which the human KeyListener is enabled, loses its focus.
-
loop
protected void loop()Empty.
-