Funkin icon indicating copy to clipboard operation
Funkin copied to clipboard

timer sequence

Open cyn0x8 opened this issue 9 months ago • 9 comments

qol class for a making batches of flxtimers, so you can do stuff like

new Sequence([
    {time: 1, callback: some_func},
    {time: 2.5, callback: () -> {
        some_var = true;
    }}
], Conductor.beatLengthMs / 1000);

instead of

new FlxTimer().start(1 * (Conductor.beatLengthMs / 1000), some_func);
new FlxTimer().start(2.5 * (Conductor.beatLengthMs / 1000), () -> {
    some_var = true;
});

cyn0x8 avatar May 09 '24 07:05 cyn0x8

im unsure if a pr is the right place for a feature request... but posting all that code into a feature request issue feels unfit sorry if im going about this the wrong way lol

cyn0x8 avatar May 09 '24 07:05 cyn0x8

Oh wait instead of it depend on deltatimes, why not also make it for conductor songPosition too

(This sounds much for a feature actually and there prob already a equivalent that is events)

Raltyro avatar May 09 '24 07:05 Raltyro

Oh wait instead of it depend on deltatimes, why not also make it for conductor songPosition too

(This sounds much for a feature actually and there prob already a equivalent that is events)

doesnt have to be used in just playstate tho... but ill try looking for a way to make it optionally follow song pos, or just pause/resume/stop when the song pauses/resumes/stops

cyn0x8 avatar May 09 '24 07:05 cyn0x8

Maybe you want to use it everywhere, not only inside songs

Pietrodjaowjao avatar May 09 '24 14:05 Pietrodjaowjao

Could add an option or make a variant that uses Conductor.instance.songPosition then

nebulazorua avatar May 09 '24 19:05 nebulazorua

i believe this should do it? do tell me if any of you find potential errors

...except the one fixed below lol

cyn0x8 avatar May 09 '24 23:05 cyn0x8

this looks lovely, maybe can even be in base Flixel code ! gonna poke @Geokureli to see if this might be cool, otherwise I'll mark this as reviewing internally!

ninjamuffin99 avatar May 24 '24 20:05 ninjamuffin99

Going to suspend this and wait to see if it gets merged into Flixel.

EliteMasterEric avatar May 29 '24 05:05 EliteMasterEric

Going to suspend this and wait to see if it gets merged into Flixel.

I don't plan on adding this in the immediate future, and if I did I'm considering something less adhoc

If people want this feature now they can borrow this implementation, which seems good, for now

Geokureli avatar May 29 '24 17:05 Geokureli