Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// doesn't work
var TH_SpritesetMap_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function() {
TH_SpritesetMap_createLowerLayer.call(this);
this.createEmitter();
}
Spriteset_Map.prototype.createEmitter = function() {
var conf = {
"alpha": {
"start": 0.1,
"end": 10
},
"scale": {
"start": 1,
"end": 0.3
},
"color": {
"start": "fb1010",
"end": "f5b830"
},
"speed": {
"start": 200,
"end": 100
},
"startRotation": {
"min": 0,
"max": 360
},
"rotationSpeed": {
"min": 0,
"max": 0
},
"lifetime": {
"min": 0.5,
"max": 1.5
},
"frequency": 0.008,
"emitterLifetime": 200,
"maxParticles": 1000,
"pos": {
"x": 0,
"y": 0
},
"addAtBack": false,
"spawnType": "circle",
"spawnCircle": {
"x": 0,
"y": 0,
"r": 10
}
};
var img = ImageManager.loadSystem("RingMenuBattle");
// img = new PIXI.Sprite(PIXI.Texture.fromImage("img/system/RingMenuBattle.png"));
var self = this;
img.addLoadListener(function() {
var sprite = new PIXI.Sprite(PIXI.Texture.fromImage("img/system/RingMenuBattle.png"))
self._emitter = new cloudkid.Emitter(self._baseSprite, [sprite], conf);
self._emitter.emit = true;
self._lastEmit = Date.now();
});
};
var TH_SpritesetMap_update = Spriteset_Map.prototype.update;
Spriteset_Map.prototype.update = function() {
TH_SpritesetMap_update.call(this);
if (this._emitter) {
var now = Date.now();
this._emitter.update((now - this._lastEmit) * 0.001);
this._lastEmit = now;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.