fix particles
This commit is contained in:
parent
8da89f1032
commit
0d5ce8f62c
|
@ -75,6 +75,7 @@ var sprite = {
|
||||||
// self?.anim_done?.();
|
// self?.anim_done?.();
|
||||||
// if (!self.loop) { self.stop(); return; }
|
// if (!self.loop) { self.stop(); return; }
|
||||||
}
|
}
|
||||||
|
if (self)
|
||||||
stop = self.gameobject.delay(advance, playing.frames[f].time);
|
stop = self.gameobject.delay(advance, playing.frames[f].time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -380,6 +380,7 @@ dup(diff) {
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
if (this.stop instanceof Function) this.stop();
|
if (this.stop instanceof Function) this.stop();
|
||||||
|
if (typeof this.garbage === 'function') this.garbage();
|
||||||
|
|
||||||
game.tag_clear_guid(this.guid);
|
game.tag_clear_guid(this.guid);
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ emitter.spawn = function(t)
|
||||||
this.particles[par.id] = par;
|
this.particles[par.id] = par;
|
||||||
par.time = 0;
|
par.time = 0;
|
||||||
this.spawn_hook?.(par);
|
this.spawn_hook?.(par);
|
||||||
|
par.life = this.life;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,8 +85,8 @@ emitter.step = function(dt)
|
||||||
for (var p of Object.values(this.particles)) {
|
for (var p of Object.values(this.particles)) {
|
||||||
p.time += dt;
|
p.time += dt;
|
||||||
this.step_hook?.(p);
|
this.step_hook?.(p);
|
||||||
|
|
||||||
if (p.time >= p.life) {
|
if (this.kill_hook?.(p) || p.time >= p.life) {
|
||||||
this.die_hook?.(p);
|
this.die_hook?.(p);
|
||||||
this.dead.push(this.particles[p.id]);
|
this.dead.push(this.particles[p.id]);
|
||||||
delete this.particles[p.id];
|
delete this.particles[p.id];
|
||||||
|
|
|
@ -363,6 +363,7 @@ Register.add_cb("gui_dbg", true);
|
||||||
Register.add_cb("hud_dbg", true);
|
Register.add_cb("hud_dbg", true);
|
||||||
Register.add_cb("draw", true);
|
Register.add_cb("draw", true);
|
||||||
Register.add_cb("imgui", true);
|
Register.add_cb("imgui", true);
|
||||||
|
Register.add_cb("post", true);
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
events: {},
|
events: {},
|
||||||
|
|
|
@ -1118,6 +1118,9 @@ prosperon.render = function()
|
||||||
render.flush_text();
|
render.flush_text();
|
||||||
mum.style = mum.base;
|
mum.style = mum.base;
|
||||||
|
|
||||||
|
prosperon.post();
|
||||||
|
check_flush();
|
||||||
|
|
||||||
profile.endframe();
|
profile.endframe();
|
||||||
|
|
||||||
profile.frame("imgui");
|
profile.frame("imgui");
|
||||||
|
|
|
@ -57,8 +57,9 @@ var song;
|
||||||
// Play 'file' for new song, cross fade for seconds
|
// Play 'file' for new song, cross fade for seconds
|
||||||
audio.music = function(file, fade = 0.5) {
|
audio.music = function(file, fade = 0.5) {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
if (song)
|
if (song)
|
||||||
song.volume = 0;
|
song.volume = 0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
file = Resources.find_sound(file);
|
file = Resources.find_sound(file);
|
||||||
if (!fade) {
|
if (!fade) {
|
||||||
|
|
Loading…
Reference in a new issue