Skip to content

@emile/engine


@emile/engine / rendering/spriteTag / SpriteTag

Class: SpriteTag

Defined in: src/rendering/spriteTag.ts:4

A component is a piece of data that can be attached to an entity.

An important fact to note is that components must be serializable. However, once the component is transferred over the wire, it loses it's prototype. This means that any methods or properties that are not annotated with @type will not be available on the client. DO NOT TRY TO SERIALISE METHODS!

Use static methods that take the component instance as an argument instead, and only use properties which are annotated with @type.

Extends

Constructors

new SpriteTag()

new SpriteTag(spriteType, overrideWidth, overrideHeight, opacity): SpriteTag

Defined in: src/rendering/spriteTag.ts:12

Parameters

spriteType

number = -1

overrideWidth

number = 0

overrideHeight

number = 0

opacity

number = 1

Returns

SpriteTag

Overrides

Component.constructor

Properties

$callbacks

protected $callbacks: object

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:35

Index Signature

[op: number]: Function[]

Inherited from

Component.$callbacks


$changes

protected $changes: ChangeTree

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:34

Inherited from

Component.$changes


componentId

readonly componentId: number

Defined in: src/ecs/component.ts:26

Inherited from

Component.componentId


opacity

opacity: number = 1

Defined in: src/rendering/spriteTag.ts:10


overrideHeight

overrideHeight: number = 0

Defined in: src/rendering/spriteTag.ts:9


overrideWidth

overrideWidth: number = 0

Defined in: src/rendering/spriteTag.ts:8


spriteType

spriteType: number = -1

Defined in: src/rendering/spriteTag.ts:7


_context

static _context: Context

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:30

Inherited from

Component._context


_definition

static _definition: SchemaDefinition

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:31

Inherited from

Component._definition


_typeid

static _typeid: number

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:29

Inherited from

Component._typeid


COMPONENT_ID

readonly static COMPONENT_ID: number = 199

Defined in: src/rendering/spriteTag.ts:5

The unique identifier of the component.

You must set this value to the unique identifier of the component.

This is required to identify the component on an entity, between the client and server.

This should be the same on the client and server across all instances of the same component.

Note

The id must be between 0 and 190 (inclusive), 191 - 255 are reserved for the engine.

Overrides

Component.COMPONENT_ID

Accessors

_definition

Get Signature

get protected _definition(): SchemaDefinition

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:44

Returns

SchemaDefinition

Inherited from

Component._definition

Methods

applyFilters()

applyFilters(client, encodeAll?): number[]

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:62

Parameters

client

any

encodeAll?

boolean

Returns

number[]

Inherited from

Component.applyFilters


assign()

assign(props): this

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:41

Parameters

props

{ componentId: number; opacity: number; overrideHeight: number; overrideWidth: number; spriteType: number; } | ToJSON<SpriteTag>

Returns

this

Inherited from

Component.assign


clone()

clone(): this

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:63

Returns

this

Inherited from

Component.clone


decode()

decode(bytes, it?, ref?): DataChange<any, string>[]

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:59

Parameters

bytes

number[]

it?

Iterator

ref?

Ref

Returns

DataChange<any, string>[]

Inherited from

Component.decode


deleteByIndex()

protected deleteByIndex(index): void

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:67

Parameters

index

number

Returns

void

Inherited from

Component.deleteByIndex


discardAllChanges()

discardAllChanges(): void

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:65

Returns

void

Inherited from

Component.discardAllChanges


encode()

encode(encodeAll?, bytes?, useFilters?): number[]

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:60

Parameters

encodeAll?

boolean

bytes?

number[]

useFilters?

boolean

Returns

number[]

Inherited from

Component.encode


encodeAll()

encodeAll(useFilters?): number[]

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:61

Parameters

useFilters?

boolean

Returns

number[]

Inherited from

Component.encodeAll


getByIndex()

protected getByIndex(index): any

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:66

Parameters

index

number

Returns

any

Inherited from

Component.getByIndex


listen()

listen<K>(prop, callback, immediate?): () => boolean

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:58

Client-side: listen for changes on property.

Type Parameters

K

K extends NonFunctionPropNames<SpriteTag>

Parameters

prop

K

the property name

callback

(value, previousValue) => void

callback to be triggered on property change

immediate?

boolean

trigger immediatelly if property has been already set.

Returns

Function

Returns

boolean

Inherited from

Component.listen


onChange()

onChange(callback): () => void

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:38

Parameters

callback

() => void

Returns

Function

Returns

void

Inherited from

Component.onChange


onRemove()

onRemove(callback): () => void

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:39

Parameters

callback

() => void

Returns

Function

Returns

void

Inherited from

Component.onRemove


setDirty()

setDirty<K>(property, operation?): void

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:51

(Server-side): Flag a property to be encoded for the next patch.

Type Parameters

K

K extends NonFunctionPropNames<SpriteTag>

Parameters

property

string representing the property name, or number representing the index of the property.

number | K

operation?

OPERATION

OPERATION to perform (detected automatically)

Returns

void

Inherited from

Component.setDirty


toJSON()

toJSON(): ToJSON<SpriteTag>

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:64

Returns

ToJSON<SpriteTag>

Inherited from

Component.toJSON


is()

static is(type): boolean

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:33

Parameters

type

DefinitionType

Returns

boolean

Inherited from

Component.is


onError()

static onError(e): void

Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:32

Parameters

e

any

Returns

void

Inherited from

Component.onError