-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81a1bb4
commit ece646e
Showing
6 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set main=./examples/bitmap-zone/text-particles.js | ||
cd .. | ||
cd .. | ||
npm run dev |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set main=./examples/bitmap-zone/texture-particles.js | ||
cd .. | ||
cd .. | ||
npm run dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import phaser from 'phaser/src/phaser.js'; | ||
import BitmapZonePlugin from '../../plugins/bitmapzone-plugin.js'; | ||
import CanvasPlugin from '../../plugins/canvas-plugin.js'; | ||
|
||
class Demo extends Phaser.Scene { | ||
constructor() { | ||
super({ | ||
key: 'examples' | ||
}) | ||
} | ||
|
||
preload() { | ||
this.load.atlas('flares', 'assets/images/particles/flares/flares.png', 'assets/images/particles/flares/flares.json'); | ||
this.load.image('money', 'assets/images/money.png'); | ||
} | ||
|
||
create() { | ||
var canvasObject = this.add.rexCanvas(400, 300) | ||
.loadTexture('money') | ||
.setScale(10) | ||
.setVisible(false); | ||
|
||
var canvasZone = this.plugins.get('rexBitmapZone').add(canvasObject); | ||
|
||
var emitter = this.add.particles(400, 300, 'flares', { | ||
blendMode: 'ADD', | ||
scale: { start: 0.1, end: 0.2 }, | ||
quantity: 10, | ||
advance: 1000, | ||
speed: 8, | ||
gravityY: -20, | ||
emitZone: { | ||
type: 'random', | ||
source: canvasZone | ||
} | ||
}) | ||
|
||
} | ||
|
||
update() { } | ||
} | ||
|
||
var config = { | ||
type: Phaser.AUTO, | ||
parent: 'phaser-example', | ||
width: 800, | ||
height: 600, | ||
scale: { | ||
mode: Phaser.Scale.FIT, | ||
autoCenter: Phaser.Scale.CENTER_BOTH, | ||
}, | ||
scene: Demo, | ||
plugins: { | ||
global: [ | ||
{ | ||
key: 'rexBitmapZone', | ||
plugin: BitmapZonePlugin, | ||
start: true | ||
}, | ||
{ | ||
key: 'rexCanvasPlugin', | ||
plugin: CanvasPlugin, | ||
start: true | ||
}, | ||
] | ||
} | ||
}; | ||
|
||
var game = new Phaser.Game(config); |