interfaces impl - wxyz-abcd/node-haxball GitHub Wiki

Impl

Implementation of Haxball's inner classes. Some important classes are exported through this object.

The explanations will be cut short, vague and sometimes partially ambiguous here; and only some of the properties of classes will be explored due to the potentially harmful nature of explaining these in detail.

The classes are put into 3 categories for now:

1. Core

Some important core classes used inside Haxball.

1.1. Point

The Point class that is used internally inside the game's physics engine.

1.1.1. Properties

  • x: number: The x coordinate of the point.
  • y: number: The y coordinate of the point.

1.2. TeamColors

The class that defines the colors of a team.

1.2.1. Properties

  • angle: number: The angle of stripes rendered inside a player.
  • text: int: The numeric color of the avatar text rendered inside a player.
  • inner: int[]: The numeric colors of each stripe rendered inside a player.

1.3. Team

The class that defines the properties of a team.

1.3.1. Static objects

  • spec: Team: The static spectators team.
  • red: Team: The static red team.
  • blue: Team: The static blue team.
  • byId: Team[]: A static array to get all teams using their ids. Its definition is Team.byId = [Team.spec, Team.red, Team.blue].

1.3.2. Properties

  • id: int: The id of current Team object.
  • color: int: The numeric color value of current Team object.

2. Stream

These classes are used to read/write data from/to replay files and/or network/WebRTC stream.

2.1. Reader

StreamReader class

2.2. Writer

StreamWriter class