fix particles

This commit is contained in:
John Alanbrook 2024-09-09 18:55:07 -05:00
parent 8da89f1032
commit 0d5ce8f62c
6 changed files with 11 additions and 3 deletions

View file

@ -75,6 +75,7 @@ var sprite = {
// self?.anim_done?.();
// if (!self.loop) { self.stop(); return; }
}
if (self)
stop = self.gameobject.delay(advance, playing.frames[f].time);
}

View file

@ -380,6 +380,7 @@ dup(diff) {
this.clear();
if (this.stop instanceof Function) this.stop();
if (typeof this.garbage === 'function') this.garbage();
game.tag_clear_guid(this.guid);

View file

@ -48,6 +48,7 @@ emitter.spawn = function(t)
this.particles[par.id] = par;
par.time = 0;
this.spawn_hook?.(par);
par.life = this.life;
return;
}
@ -85,7 +86,7 @@ emitter.step = function(dt)
p.time += dt;
this.step_hook?.(p);
if (p.time >= p.life) {
if (this.kill_hook?.(p) || p.time >= p.life) {
this.die_hook?.(p);
this.dead.push(this.particles[p.id]);
delete this.particles[p.id];

View file

@ -363,6 +363,7 @@ Register.add_cb("gui_dbg", true);
Register.add_cb("hud_dbg", true);
Register.add_cb("draw", true);
Register.add_cb("imgui", true);
Register.add_cb("post", true);
var Event = {
events: {},

View file

@ -1118,6 +1118,9 @@ prosperon.render = function()
render.flush_text();
mum.style = mum.base;
prosperon.post();
check_flush();
profile.endframe();
profile.frame("imgui");

View file

@ -59,6 +59,7 @@ audio.music = function(file, fade = 0.5) {
if (!file) {
if (song)
song.volume = 0;
return;
}
file = Resources.find_sound(file);
if (!fade) {