a3-phaser-functionality-extension
v3.0.0
Published
Collection of Phaser Mixins (Extension) script for common uses
Downloads
7
Readme
A3-Phaser-Object-ext
Basic phaser functionality extension that add additional function to phaser components.
Documentation is scarce as i myself still learning and hope to get some feedback
jsdoc should serve enough docs for now
Installation:
# git
npm install git+https://gategit.agate.id/billy.firman/a3-phaser-object-ext
# npm registry
npm install a3-phaser-functionality-extension
Usage
Extension
import {SizeExtension} from "a3-phaser-object-ext";
// global Scope (applied to entire game)
Object.assign(Phaser.GameObjects.Image.prototype, SizeExtension);
// object scope (only applied to assigned object)
const image = new Image(30, 20);
Object.assign(image, SizeExtension);
// example use
image.setMaxPreferredDisplaySize(200, 300);
Graphic Fill
const img = this.add.sprite(0, 0, UIAsset.result_home_button.key)
img.setPosition(this.scale.width * .5)
const radialFill = new RadialFill(this);
radialFill.assignFillAnchor(img, img.displayWidth, -90, true)
radialFill.setVisible(false)
img.setMask(radialFill.createGeometryMask());
radialFill.fillValue = .15;