@kvisaz/phaser-sugar
v1.1.6
Published
Phaser 3 utils and syntax sugar
Readme
phaser-sugar
Phaser 3.80 tools and utilities
version 1.1.5
Features
- layoutColumn, layoutRow, layoutChain
- ViewPort component
- typeGuards for TypeScript:
- isScene, isRectangle, hasGetBounds, hasWidthHeight
- isContainer, isImage, isSpite, isText
- Layout for area layout
- AlignMethod as command collectios for Align.applyMethod(alignMethod, obj, ...args)
- align chains for array layouts - rows, columns, chains
- ArrayAlignObject class for array layout without containers
- ChildSceneProxy - easy add child scene, like popup or ui, to pause main scene
- setContainerInteractive (add size before setInteractive)
- Align objects - any GameObject with x,y, setPosition, getBounds
- NineSlice, Zone added as type to Align
- NiceText - add text in nice style with fontSizePx and wordWrap
- Preload tasks - just write PreloadTask.load(scene, ()=>Promise) to wait async operations in Phaser Load
- font loader
loadFont({
scene, fontFamily: "Title", url: `${urlBase}/BalsamiqSans-Bold.ttf`
});- Align - positioning game objects relative to each other with any origin
- setLeftTop - set left and top of object with any origin
- cssColorToInt - convert css color string To Phaser Int color
- intToCssColor - convert Phaser int color to css color string
- delay - async setTimeout
- tweenPromise - async Phaser tweens
- Deffered - delayed Promise
- async loaders - async sugar for Phaser asset loading in any time
Components
- TextRectangle - rectangle with text, adaptive to text size by default
