Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timer sequence #2391

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

timer sequence #2391

wants to merge 5 commits into from

Conversation

cyn0x8
Copy link

@cyn0x8 cyn0x8 commented May 9, 2024

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: function() {
        some_var = true;
    }}
], Conductor.beatLengthMs / 1000);

qol class for a making batches of flxtimers, so you can do stuff like
```haxe
new Sequence([
    {time: 1, callback: some_func},
    {time: 2.5, callback: function() {
        some_var = true;
    }}
], Conductor.beatLengthMs / 1000);
```
@cyn0x8
Copy link
Author

cyn0x8 commented May 9, 2024

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

@Raltyro
Copy link

Raltyro commented May 9, 2024

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)

@cyn0x8
Copy link
Author

cyn0x8 commented May 9, 2024

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

@Pietrodjaowjao
Copy link

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

@nebulazorua
Copy link
Contributor

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

@cyn0x8
Copy link
Author

cyn0x8 commented May 9, 2024

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

...except the one fixed below lol

cyn0x8 added 2 commits May 9, 2024 16:34
fix potential null access when the last timer is removed
and changed to iterate through the whole array to support event lists that arent in ascending order (iterating in reverse so in-place array modification via `remove` doesnt mess anything up)
@cyn0x8 cyn0x8 closed this May 13, 2024
@cyn0x8 cyn0x8 deleted the patch-1 branch May 13, 2024 18:12
@cyn0x8 cyn0x8 restored the patch-1 branch May 13, 2024 18:13
@cyn0x8 cyn0x8 reopened this May 13, 2024
@ninjamuffin99
Copy link
Member

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!

@EliteMasterEric
Copy link
Member

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

@Geokureli
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants