Skip to content

Commit ab87af4

Browse files
author
Ashot Avagyan
authored
Merge pull request #26 from saqsun/master
bug fixings
2 parents 5ace94d + e1cee07 commit ab87af4

File tree

12 files changed

+160
-89
lines changed

12 files changed

+160
-89
lines changed

.eslintrc.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const settings = {
33
browser: true,
44
},
55
parser: 'babel-eslint',
6-
extends: 'standard-trailing-commas',
6+
extends: 'standard',
77
plugins: ['import'],
88
settings: {
99
'import/parser': 'babel-eslint',
@@ -17,7 +17,18 @@ const settings = {
1717
NODE_ENV: true,
1818
},
1919
rules: {
20-
'space-before-function-paren': 0,
20+
'comma-dangle': [
21+
'error',
22+
{
23+
arrays: 'always-multiline',
24+
objects: 'always-multiline',
25+
imports: 'always-multiline',
26+
exports: 'always-multiline',
27+
functions: 'always-multiline',
28+
},
29+
],
30+
'no-fallthrough': ['error', { commentPattern: 'break[\\s\\w]*omitted' }],
31+
'standard/computed-property-even-spacing': 0,
2132
},
2233
}
2334

README.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,73 @@
1+
# Phaser Particle Editor Plugin
12

2-
Phaser Particle Editor Plugin
3-
================
4-
[![Build Status](https://travis-ci.org/koreezgames/phaser-particle-editor-plugin.svg?branch=master)](https://travis-ci.org/koreezgames/phaser-particle-editor-plugin) [![David](https://david-dm.org/koreezgames/phaser-particle-editor-plugin.svg)]() [![Project status](https://img.shields.io/badge/status-active-brightgreen.svg)](#status)
3+
[![Build Status](https://travis-ci.org/koreezgames/phaser-particle-editor-plugin.svg?branch=master)](https://travis-ci.org/koreezgames/phaser-particle-editor-plugin) [![David](https://david-dm.org/koreezgames/phaser-particle-editor-plugin.svg)]() [![Project status](https://img.shields.io/badge/status-active-brightgreen.svg)](#status)
54

65
This plugin creates particle effects based on JSON data generated by **[Phaser Particle Editor](https://phaser-particle-editor.firebaseapp.com/)**
7-
8-
Getting Started
9-
---------------
6+
7+
## Getting Started
8+
109
### Installation
11-
#### ***Using script tag:***
10+
11+
#### **_Using script tag:_**
12+
1213
[![](https://data.jsdelivr.com/v1/package/npm/@koreez/phaser-particle-editor-plugin/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@koreez/phaser-particle-editor-plugin/dist/plugin.min.js)
14+
1315
```html
1416
<script src="//cdn.jsdelivr.net/npm/@koreez/phaser-particle-editor-plugin/dist/plugin.min.js"></script>
1517
```
16-
#### ***Using npm:***
18+
19+
#### **_Using npm:_**
20+
1721
[![npm](https://img.shields.io/npm/dt/@koreez/phaser-particle-editor-plugin.svg)](https://www.npmjs.com/package/@koreez/phaser-particle-editor-plugin)
22+
1823
```shell
1924
$ npm i -g npm
2025
$ npm i --save @koreez/phaser-particle-editor-plugin
2126
```
22-
Usage
23-
-----
27+
28+
## Usage
29+
2430
### Import the plugin
25-
##### ***CommonJS***
31+
32+
##### **_CommonJS_**
33+
2634
```javascript
27-
var ParticleEditorPlugin = require('@koreez/phaser-particle-editor-plugin')
35+
var ParticleEditorPlugin = require("@koreez/phaser-particle-editor-plugin");
2836
```
29-
##### ***ES2015***
37+
38+
##### **_ES2015_**
39+
3040
```javascript
31-
import { ParticleEditorPlugin } from '@koreez/phaser-particle-editor-plugin'
41+
import ParticleEditorPlugin from "@koreez/phaser-particle-editor-plugin";
3242
```
43+
3344
### Load the plugin
45+
3446
You need to load the plugin in your game. This is done just like any other plugin in Phaser.
3547
So, to load the plugin, include it one of the Phaser States.
48+
3649
```javascript
3750
game.plugins.add(ParticleEditorPlugin);
3851
```
39-
The plugin will patch your Phaser game with additional *add / make* methods so this plugin fits up in Phaser like any normal object.
52+
53+
The plugin will patch your Phaser game with additional _add / make_ methods so this plugin fits up in Phaser like any normal object.
54+
4055
### Create particles
56+
4157
```javascript
4258
// x - any
4359
// y - any
4460
// data - should be already loaded JSON key or existing object based on Particle Editor data
4561
// group - parent container
46-
game.add.particleEffect(x, y, data, group)
62+
game.add.particleEffect(x, y, data, group);
4763
// or
48-
game.make.particleEffect(x, y, data)
64+
game.make.particleEffect(x, y, data);
4965
```
5066

5167
## News & Community
68+
5269
We have a [forum](http://www.html5gamedevs.com/topic/33387-phaser-particle-editor/) so you can always be up to date with latest news!
70+
5371
## Contributing
54-
Coming soon!
72+
73+
Coming soon!

config/.eslintrc.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
const settings = {
22
env: {
33
browser: false,
4-
node: true
4+
node: true,
5+
},
6+
extends: 'standard',
7+
rules: {
8+
'comma-dangle': [
9+
'error',
10+
{
11+
arrays: 'always-multiline',
12+
objects: 'always-multiline',
13+
imports: 'always-multiline',
14+
exports: 'always-multiline',
15+
functions: 'always-multiline',
16+
},
17+
],
518
},
6-
extends: 'standard-trailing-commas'
719
}
820

921
module.exports = settings

config/webpack.config.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ const libConfig = merge([
3030
},
3131
output: {
3232
path: paths.dist,
33+
libraryExport: 'default',
3334
},
3435
resolve: {
3536
alias: {
36-
'phaser': paths.phaser,
37+
phaser: paths.phaser,
3738
},
3839
modules: [path.resolve('./node_modules'), path.resolve('./src')],
3940
extensions: ['.json', '.js'],
@@ -78,7 +79,7 @@ const varConfig = merge([
7879
umdNamedDefine: false,
7980
},
8081
externals: {
81-
'phaser': 'Phaser',
82+
phaser: 'Phaser',
8283
},
8384
},
8485
])
@@ -93,20 +94,16 @@ const umdConfig = merge([
9394
},
9495
externals: {
9596
phaser: {
96-
commonjs: 'phaser',
97-
commonjs2: 'phaser',
98-
amd: 'phaser',
97+
commonjs: 'Phaser',
98+
commonjs2: 'Phaser',
99+
amd: 'Phaser',
99100
root: 'Phaser',
100101
},
101102
},
102103
},
103104
])
104105

105106
module.exports = env => {
106-
const config = merge(
107-
libConfig,
108-
env === 'var' ? varConfig : umdConfig
109-
)
110-
107+
const config = merge(libConfig, env === 'var' ? varConfig : umdConfig)
111108
return config
112109
}

package-lock.json

Lines changed: 1 addition & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@koreez/phaser-particle-editor-plugin",
3-
"version": "1.0.0-alpha.18",
3+
"version": "1.0.0-alpha.19",
44
"description": "Phaser Particle Editor Plugin",
55
"main": "dist/library.js",
66
"scripts": {
@@ -16,15 +16,13 @@
1616
"babel-cli": "^6.26.0",
1717
"babel-eslint": "^7.2.3",
1818
"babel-loader": "^7.0.0",
19-
"babel-plugin-add-module-exports": "^0.2.1",
2019
"babel-preset-env": "^1.6.1",
2120
"babel-preset-stage-2": "^6.24.1",
2221
"case-sensitive-paths-webpack-plugin": "^2.1.1",
2322
"clean-webpack-plugin": "^0.1.17",
2423
"concurrently": "^3.5.1",
2524
"eslint": "^3.19.0",
2625
"eslint-config-standard": "^10.2.1",
27-
"eslint-config-standard-trailing-commas": "^6.1.0",
2826
"eslint-plugin-import": "^2.8.0",
2927
"eslint-plugin-node": "^4.2.2",
3028
"eslint-plugin-promise": "^3.6.0",

src/com/koreez/particleeditorplugin/ExtendedEmitter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import Phaser from 'phaser'
22
import ExtendedParticle from './ExtendedParticle'
33

44
export default class ExtendedEmitter extends Phaser.Particles.Arcade.Emitter {
5-
constructor(game, name, properties) {
5+
constructor (game, name, properties) {
66
super(game, properties.emitX, properties.emitY, properties.maxParticles)
77
this.name = name
88
this.particleClass = ExtendedParticle
99
this.applyProperties(properties)
1010
}
1111

12-
applyProperties(properties) {
12+
applyProperties (properties) {
1313
this.properties = properties
1414
this.gravity.x = properties.gravityX
1515
this.gravity.y = properties.gravityY
@@ -60,7 +60,7 @@ export default class ExtendedEmitter extends Phaser.Particles.Arcade.Emitter {
6060
]
6161
}
6262

63-
resetParticle(particle, x, y) {
63+
resetParticle (particle, x, y) {
6464
super.resetParticle(particle, x, y)
6565
if (this.particleArgumentsColor) {
6666
particle.tint = Phaser.Color.getColor32(

src/com/koreez/particleeditorplugin/ExtendedParticle.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Phaser from 'phaser'
22

33
export default class ExtendedParticle extends Phaser.Particle {
4-
constructor(game, x, y, key, frame, particleArguments) {
4+
constructor (game, x, y, key, frame, particleArguments) {
55
super(game, x, y, key, frame)
66
this.particleArgumentsColor = particleArguments['color'] || null
77
}
88

9-
onEmit() {
9+
onEmit () {
1010
if (this.particleArgumentsColor) {
1111
const startColor = Phaser.Color.createColor(
1212
this.particleArgumentsColor.start.r,
@@ -32,7 +32,7 @@ export default class ExtendedParticle extends Phaser.Particle {
3232
super.onEmit()
3333
}
3434

35-
updateColor(tween) {
35+
updateColor (tween) {
3636
Phaser.Color.updateColor(tween.target)
3737
this.tint = Phaser.Color.getColor32(
3838
this.alpha,
@@ -42,7 +42,7 @@ export default class ExtendedParticle extends Phaser.Particle {
4242
)
4343
}
4444

45-
onTweenComplete(tween) {
45+
onTweenComplete (tween) {
4646
this.game.tweens.remove(tween)
4747
}
4848
}

src/com/koreez/particleeditorplugin/ParticleEditorPlugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import ParticleEffect from './ParticleEffect'
22
import Phaser from 'phaser'
33

44
export default class ParticleEditorPlugin extends Phaser.Plugin {
5-
constructor(game, parent) {
5+
constructor (game, parent) {
66
super(game, parent)
77
this.addParticleFactory()
88
}
99

10-
addParticleFactory() {
10+
addParticleFactory () {
1111
Phaser.GameObjectFactory.prototype.particleEffect = (x, y, key, group) => {
1212
const particle = new ParticleEffect(this.game, this.getData(key), x, y)
1313
return (group || this.game.world).add(particle)
@@ -17,7 +17,7 @@ export default class ParticleEditorPlugin extends Phaser.Plugin {
1717
}
1818
}
1919

20-
getData(key) {
20+
getData (key) {
2121
if (typeof key === 'string') {
2222
return this.game.cache.getJSON(key)
2323
}

0 commit comments

Comments
 (0)