Home Reference Source
public class | source

Player

Extends:

pixi.js~PIXI.SpriteGameObject → Player

Constructor Summary

Public Constructor
public

constructor(texture: PIXI.Texture, id: string, name: string, room: string, team: string, health: number, x: number, y: number, vx: number, vy: number)

Constructor for creating a new Player in the server side.

Member Summary

Public Members
public

damagedBy: {}

public
public
public

health: *

public

height: *

public
public

name: *

public
public

room: *

public
public
public
public
public

team: *

public
public

width: *

public

x: *

public

y: *

Method Summary

Public Methods
public
public

changeSprite(shield: number, stronghold: string)

Notifies the player to check for a sprite change (shield, etc).

public

setup()

First-time setup for this player.

public

tick()

Draws all components of a given player.

Inherited Summary

From class GameObject
public
public

id: *

public

posX: *

public

posY: *

public

texture: *

public

vx: *

public

vy: *

public

x: *

public

y: *

public

Destroyes the Sprite

public

draw()

Call during tick() if necessary.

public

TEMP Moves this object to (9999, 9999) on local screen space, effectively hiding it from view.

public

setCoordinates(newX: number, newY: number)

Sets global coordinates of this player

public

setData(newX: number, newY: number, vx: number, vy: number)

Sets global coordinates and speeds of this player

public

setup()

Override optional.

public

tick(noDraw: boolean)

Override optional.

Public Constructors

public constructor(texture: PIXI.Texture, id: string, name: string, room: string, team: string, health: number, x: number, y: number, vx: number, vy: number) source

Constructor for creating a new Player in the server side. Player is a Sprite instance that can be added to the stage. Each Player should only be created once, and updated subsequently with setData().

Override:

GameObject#constructor

Params:

NameTypeAttributeDescription
texture PIXI.Texture

The texture associated with this sprite

id string

Socket ID of the player

name string

Name of the player

room string

Room that the player belongs to

team string

Team that the player belongs to

health number

Health of the player

x number

Global x-coordinate

y number

Global y-coordinate

vx number

Horizontal velocity

vy number

Vertical velocity

Public Members

public damagedBy: {} source

public experience: * source

public filters: undefined[] source

public health: * source

public height: * source

public isMoving: boolean source

public name: * source

public playerSprite: * source

public room: * source

public shield: number source

public spectating: boolean source

public speedMult: number source

public stronghold: string source

public team: * source

public textObjects: {} source

public width: * source

public x: * source

Override:

GameObject#x

public y: * source

Override:

GameObject#y

Public Methods

public beginSpectate() source

public changeSprite(shield: number, stronghold: string) source

Notifies the player to check for a sprite change (shield, etc).

Params:

NameTypeAttributeDescription
shield number

Number of extra defense points from buffs, elements, etc.

stronghold string

'team' if player is in team stronghold, 'notteam' if player is in enemy stronghold, 'none', if not in a stronghold

public setup() source

First-time setup for this player. All of the functions in this method will only be called once.

Override:

GameObject#setup

public tick() source

Draws all components of a given player. This method should be included in the ticker and called once a frame. Therefore, all setup tasks should be called in setup().

Override:

GameObject#tick