Class ServerInputHandler

Classdesc

MultiPlayerServerInput class, used for handling input on the server side of a multiplayer game

Example

const input = new MultiPlayerServerInput({
key: "w",
fireRate: 10,
on: (socket, playerObject) => {
playerObject.move(0, -1);
}
});

Constructors

Properties

active: boolean

Whether or not the input is active

fireIntervals: any

Reference to all of the fire intervals

fireRate: number

Fire rate of the input

firing: any

Whether or not the input is firing for each socket

id: string

Unique ID of the input

key: string

Key that the input is bound to

on: ((socket, playerObject) => void)

Function to run when the input is fired (EventOnFunction)

Type declaration

    • (socket, playerObject): void
    • Function to run when the input is fired (EventOnFunction)

      Parameters

      Returns void

sceneManager: null | MultiPlayerSceneManager

SceneManager instance that the input is bound to

Methods

  • Activates the input on the given socket

    Parameters

    • socket: any

      Socket.io socket to activate the input on

    Returns void

  • Activates the input on the given sceneManager (MultiPlayerSceneManager instance)

    Parameters

    Returns void

  • Fires the input on a given socket every fireRate ms

    Parameters

    • socket: any

      Socket.io socket to start firing the input on

    Returns void

  • Stops firing the input to a given socket

    Parameters

    • socket: any

      Socket.io socket to stop firing the input on

    Returns void

Generated using TypeDoc