@latticexyz/phaserx

# @latticexyz/phaserx

# Table of contents

# Enumerations

# Classes

# Interfaces

# Type Aliases

# Variables

# Functions

# Enumerations

# AssetType

AssetType: Enum AssetType

# Defined in

packages/phaserx/src/constants.ts:1

# Classes

# HueTintAndOutlineFXPipeline

HueTintAndOutlineFXPipeline: Class HueTintAndOutlineFXPipeline

# Defined in

packages/phaserx/src/pipelines/HueTintAndOutlineFXPipeline.ts:3


# MultiHueTintPipeline

MultiHueTintPipeline: Class MultiHueTintPipeline

# Defined in

packages/phaserx/src/pipelines/MultiHueTintPipeline.ts:1

# Interfaces

# AnimatedTilemap

AnimatedTilemap: Interface AnimatedTilemap<TileKeys, LayerKeys, AnimationKeys>

# Type parameters

Name Type
TileKeys extends number
LayerKeys extends string
AnimationKeys extends string

# Defined in

packages/phaserx/src/tilemap/types.ts:19


# ChunkedTilemap

ChunkedTilemap: Interface ChunkedTilemap<TileKeys, LayerKeys>

# Type parameters

Name Type
TileKeys extends number
LayerKeys extends string

# Defined in

packages/phaserx/src/tilemap/types.ts:4


# VirtualTilemap

VirtualTilemap: Interface VirtualTilemap<TileKeys, LayerKeys>

# Type parameters

Name Type
TileKeys extends number
LayerKeys extends string

# Defined in

packages/phaserx/src/tilemap/types.ts:14

# Type Aliases

# Asset

Ƭ Asset: Object | Object | Object

# Defined in

packages/phaserx/src/types.ts:176


# Camera

Ƭ Camera: Object

# Type declaration

Name Type
centerOn Function
centerOnCoord Function
dispose Function
ignore Function
phaserCamera Phaser.Cameras.Scene2D.Camera
setScroll Function
setZoom Function
worldView$ Observable<Phaser.Cameras.Scene2D.Camera["worldView"]>
zoom$ Observable<number>

# Defined in

packages/phaserx/src/types.ts:13


# Coord

Ƭ Coord: Object

# Type declaration

Name Type
x number
y number

# Defined in

packages/phaserx/src/types.ts:54


# Key

Ƭ Key: keyof typeof Phaser.Input.Keyboard.KeyCodes | "POINTER_LEFT" | "POINTER_RIGHT"

# Defined in

packages/phaserx/src/createInput.ts:18


# TileAnimation

Ƭ TileAnimation: TileKeys[]

# Type parameters

Name Type
TileKeys extends number

# Defined in

packages/phaserx/src/tilemap/types.ts:28

# Variables

# GameObjectClasses

Const GameObjectClasses: Object

# Type declaration

Name Type
Line typeof Line
Rectangle typeof Rectangle
Sprite typeof Sprite
Text typeof Text

# Defined in

packages/phaserx/src/constants.ts:7


# ZERO_VECTOR

Const ZERO_VECTOR: Coord

# Defined in

packages/phaserx/src/utils/coords.ts:3

# Functions

# addCoords

addCoords(a, b): Object

# Parameters

Name Type
a Coord
b Coord

# Returns

Object

Name Type
x number
y number

# Defined in

packages/phaserx/src/utils/coords.ts:34


# chunkCoordToTileCoord

chunkCoordToTileCoord(chunkCoord, tileWidth, tileHeight, chunkSize): WorldCoord

# Parameters

Name Type
chunkCoord Coord
tileWidth number
tileHeight number
chunkSize number

# Returns

WorldCoord

# Defined in

packages/phaserx/src/utils/coords.ts:73


# chunkToPixelCoord

chunkToPixelCoord(chunkCoord, chunkSize): PixelCoord

# Parameters

Name Type
chunkCoord Coord
chunkSize number

# Returns

PixelCoord

# Defined in

packages/phaserx/src/utils/coords.ts:45


# coordEq

coordEq(a?, b?): boolean

# Parameters

Name Type
a? Coord
b? Coord

# Returns

boolean

# Defined in

packages/phaserx/src/utils/coords.ts:28


# cornerTileCoordsFromRegionCoords

cornerTileCoordsFromRegionCoords(regionCoords, regionLength): Coord[]

# Parameters

Name Type
regionCoords Coord[]
regionLength number

# Returns

Coord[]

# Defined in

packages/phaserx/src/utils/coords.ts:5


# createAnimatedTilemap

createAnimatedTilemap<TileKeys, LayerKeys, AnimationKeys>(config): AnimatedTilemap<TileKeys, LayerKeys, AnimationKeys>

# Type parameters

Name Type
TileKeys extends number
LayerKeys extends string
AnimationKeys extends string

# Parameters

Name Type
config Omit<ChunkedTilemapConfig<TileKeys, string>, "tiles"> & Object

# Returns

AnimatedTilemap<TileKeys, LayerKeys, AnimationKeys>

# Defined in

packages/phaserx/src/tilemap/createAnimatedTilemap.ts:9


# createCamera

createCamera(phaserCamera, options): Camera

# Parameters

Name Type
phaserCamera Camera
options CameraConfig

# Returns

Camera

# Defined in

packages/phaserx/src/createCamera.ts:6


# createChunkedTilemap

createChunkedTilemap<TileKeys, LayerKeys>(params): ChunkedTilemap<TileKeys, LayerKeys>

# Type parameters

Name Type
TileKeys extends number
LayerKeys extends string

# Parameters

Name Type
params ChunkedTilemapConfig<TileKeys, LayerKeys>

# Returns

ChunkedTilemap<TileKeys, LayerKeys>

# Defined in

packages/phaserx/src/tilemap/createChunkedTilemap.ts:22


# createChunks

createChunks(worldView$, chunkSize, padding?): Object

# Parameters

Name Type Default value
worldView$ Observable<Area> undefined
chunkSize number undefined
padding number 100

# Returns

Object

Name Type
addedChunks$ Observable<Coord>
chunkSize number
removedChunks$ Observable<Coord>
visibleChunks Object
visibleChunks.current CoordMap<boolean>

# Defined in

packages/phaserx/src/createChunks.ts:6


# createCulling

createCulling(objectPool, camera, chunks): Object

# Parameters

Name Type Default value
objectPool Object undefined
objectPool.get Function undefined
objectPool.groups Object undefined
objectPool.groups.Line Group Phaser.GameObjects.Line
objectPool.groups.Rectangle Group Phaser.GameObjects.Rectangle
objectPool.groups.Sprite Group Phaser.GameObjects.Sprite
objectPool.groups.Text Group Phaser.GameObjects.Text
objectPool.ignoreCamera Function undefined
objectPool.objects ObservableMap<string, EmbodiedEntity<"Sprite" | "Rectangle" | "Line" | "Text">> undefined
objectPool.remove Function undefined
camera Camera undefined
chunks Object undefined
chunks.addedChunks$ Observable<Coord> undefined
chunks.chunkSize number undefined
chunks.removedChunks$ Observable<Coord> undefined
chunks.visibleChunks Object undefined
chunks.visibleChunks.current CoordMap<boolean> undefined

# Returns

Object

Name Type
dispose Function

# Defined in

packages/phaserx/src/createCulling.ts:45


# createDebugger

createDebugger(camera, chunks, scene, objectPool, map): void

# Parameters

Name Type Default value
camera Camera undefined
chunks Object undefined
chunks.addedChunks$ Observable<Coord> undefined
chunks.chunkSize number undefined
chunks.removedChunks$ Observable<Coord> undefined
chunks.visibleChunks Object undefined
chunks.visibleChunks.current CoordMap<boolean> undefined
scene Scene undefined
objectPool Object undefined
objectPool.get Function undefined
objectPool.groups Object undefined
objectPool.groups.Line Group Phaser.GameObjects.Line
objectPool.groups.Rectangle Group Phaser.GameObjects.Rectangle
objectPool.groups.Sprite Group Phaser.GameObjects.Sprite
objectPool.groups.Text Group Phaser.GameObjects.Text
objectPool.ignoreCamera Function undefined
objectPool.objects ObservableMap<string, EmbodiedEntity<"Sprite" | "Rectangle" | "Line" | "Text">> undefined
objectPool.remove Function undefined
map AnimatedTilemap<number, string, string> undefined

# Returns

void

# Defined in

packages/phaserx/src/createDebugger.ts:13


# createInput

createInput(inputPlugin): Object

# Parameters

Name Type
inputPlugin InputPlugin

# Returns

Object

Name Type
click$ Observable<Pointer>
disableInput Function
dispose Function
doubleClick$ Observable<Pointer>
drag$ Observable<undefined | Area>
enableInput Function
enabled Object
enabled.current boolean
keyboard$ Observable<Key>
onKeyPress Function
pointerdown$ Observable<Object>
pointermove$ Observable<Object>
pointerup$ Observable<Object>
pressedKeys ObservableSet<Key>
rightClick$ Observable<Pointer>
setCursor Function

# Defined in

packages/phaserx/src/createInput.ts:20


# createObjectPool

createObjectPool(scene): Object

# Parameters

Name Type
scene Scene

# Returns

Object

Name Type
get Function
groups Object
groups.Line Group
groups.Rectangle Group
groups.Sprite Group
groups.Text Group
ignoreCamera Function
objects ObservableMap<string, EmbodiedEntity<"Sprite" | "Rectangle" | "Line" | "Text">>
remove Function

# Defined in

packages/phaserx/src/createObjectPool.ts:15


# createPhaserEngine

createPhaserEngine<S>(options): Promise<Object>

# Type parameters

Name Type
S extends ScenesConfig

# Parameters

Name Type
options PhaserEngineConfig<S>

# Returns

Promise<Object>

# Defined in

packages/phaserx/src/createPhaserEngine.ts:15


# createVirtualTilemap

createVirtualTilemap<TileKeys, LayerKeys>(config): VirtualTilemap<TileKeys, LayerKeys>

# Type parameters

Name Type
TileKeys extends number
LayerKeys extends string

# Parameters

Name Type
config Omit<ChunkedTilemapConfig<TileKeys, LayerKeys>, "tiles">

# Returns

VirtualTilemap<TileKeys, LayerKeys>

# Defined in

packages/phaserx/src/tilemap/createVirtualTilemap.ts:7


# defineAssetsConfig

defineAssetsConfig<A>(assets): A

# Type parameters

Name Type
A extends Assets

# Parameters

Name Type
assets A

# Returns

A

# Defined in

packages/phaserx/src/guards.ts:17


# defineCameraConfig

defineCameraConfig(config): CameraConfig

# Parameters

Name Type
config CameraConfig

# Returns

CameraConfig

# Defined in

packages/phaserx/src/guards.ts:41


# defineMapConfig

defineMapConfig<A, T, L>(config): MapConfig<A, T, L>

# Type parameters

Name Type
A extends Assets
T extends TilesetConfig<A>
L extends LayerConfig<A, T>

# Parameters

Name Type
config MapConfig<A, T, L>

# Returns

MapConfig<A, T, L>

# Defined in

packages/phaserx/src/guards.ts:21


# definePhaserConfig

definePhaserConfig(options): Phaser.Types.Core.GameConfig

# Parameters

Name Type
options Object
options.scale undefined | ScaleConfig
options.scenes typeof GameScene[]

# Returns

Phaser.Types.Core.GameConfig

# Defined in

packages/phaserx/src/definePhaserConfig.ts:3


# defineScaleConfig

defineScaleConfig(config): ScaleConfig

# Parameters

Name Type
config ScaleConfig

# Returns

ScaleConfig

# Defined in

packages/phaserx/src/guards.ts:37


# defineScene

defineScene(options): typeof GameScene

# Parameters

Name Type
options Object
options.create? Function
options.key string
options.preload? Function
options.update? Function

# Returns

typeof GameScene

# Defined in

packages/phaserx/src/defineScene.ts:3


# defineSceneConfig

defineSceneConfig<A, S, T, M, Ans>(config): SceneConfig<A, S, T, M, Ans>

# Type parameters

Name Type
A extends Assets
S extends Object
T extends TilesetConfig<A>
M extends MapsConfig<A, T>
Ans extends Animation<A>[]

# Parameters

Name Type
config SceneConfig<A, S, T, M, Ans>

# Returns

SceneConfig<A, S, T, M, Ans>

# Defined in

packages/phaserx/src/guards.ts:27


# generateFrames

generateFrames<A>(anims, animation): Phaser.Types.Animations.AnimationFrame[]

# Type parameters

Name Type
A extends Assets

# Parameters

Name Type
anims AnimationManager
animation Animation<A>

# Returns

Phaser.Types.Animations.AnimationFrame[]

# Defined in

packages/phaserx/src/utils/generateFrames.ts:3


# getChunksInArea

getChunksInArea(area, chunkSize): CoordMap<boolean>

# Parameters

Name Type
area Area
chunkSize number

# Returns

CoordMap<boolean>

# Defined in

packages/phaserx/src/utils/chunks.ts:5


# getObjectsInArea

getObjectsInArea(groups, area): any[]

# Parameters

Name Type
groups Group[]
area Rectangle

# Returns

any[]

# Defined in

packages/phaserx/src/utils/area.ts:2


# isRectangle

isRectangle(gameObject, type): gameObject is Rectangle

# Parameters

Name Type
gameObject GameObject
type "Sprite" | "Rectangle" | "Line" | "Text"

# Returns

gameObject is Rectangle

# Defined in

packages/phaserx/src/guards.ts:52


# isSprite

isSprite(gameObject, type): gameObject is Sprite

# Parameters

Name Type
gameObject GameObject
type "Sprite" | "Rectangle" | "Line" | "Text"

# Returns

gameObject is Sprite

# Defined in

packages/phaserx/src/guards.ts:45


# isTileInArea

isTileInArea(tileCoord, area): boolean

# Parameters

Name Type
tileCoord Coord
area Area

# Returns

boolean

# Defined in

packages/phaserx/src/utils/coords.ts:19


# load

load(scene, callback): Promise<void>

# Parameters

Name Type
scene Scene
callback Function

# Returns

Promise<void>

# Defined in

packages/phaserx/src/utils/load.ts:3


# mod

mod(a, b): number

# Parameters

Name Type
a number
b number

# Returns

number

# Defined in

packages/phaserx/src/utils/math.ts:1


# pixelCoordToTileCoord

pixelCoordToTileCoord(pixelCoord, tileWidth, tileHeight): WorldCoord

# Parameters

Name Type
pixelCoord Coord
tileWidth number
tileHeight number

# Returns

WorldCoord

# Defined in

packages/phaserx/src/utils/coords.ts:49


# pixelToChunkCoord

pixelToChunkCoord(pixelCoord, chunkSize): ChunkCoord

# Parameters

Name Type
pixelCoord Coord
chunkSize number

# Returns

ChunkCoord

# Defined in

packages/phaserx/src/utils/coords.ts:41


# removeAllTweens

removeAllTweens(gameObject): void

# Parameters

Name Type
gameObject GameObject

# Returns

void

# Defined in

packages/phaserx/src/utils/tween.ts:33


# tileCoordToChunkCoord

tileCoordToChunkCoord(tileCoord, tileWidth, tileHeight, chunkSize): ChunkCoord

# Parameters

Name Type
tileCoord Coord
tileWidth number
tileHeight number
chunkSize number

# Returns

ChunkCoord

# Defined in

packages/phaserx/src/utils/coords.ts:63


# tileCoordToPixelCoord

tileCoordToPixelCoord(tileCoord, tileWidth, tileHeight): PixelCoord

# Parameters

Name Type
tileCoord Coord
tileWidth number
tileHeight number

# Returns

PixelCoord

# Defined in

packages/phaserx/src/utils/coords.ts:56


# tween

tween(config, options?): Promise<void>

Add a tween to the provided game object.

# Parameters

Name Type
config TweenBuilderConfig
options? Object
options.keepExistingTweens? boolean

# Returns

Promise<void>

Promise that resolves when the tween is done.

# Defined in

packages/phaserx/src/utils/tween.ts:12