-
Notifications
You must be signed in to change notification settings - Fork 435
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
"Complete all timers" and "complete all tweens" helper functions #1782
Merged
Merged
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e628666
Merge pull request #1 from HaxeFlixel/dev
77fcb10
Merge pull request #3 from HaxeFlixel/dev
03b41fd
Add completeAll() function to FlxTimerManager
a4633e7
Add completeAll() function to FlxTweenManager
ade7d5f
Don't finish loopers in completeAll()
3b47ee0
Add warning
de97e09
Don't finish loopers in other completeAll()
93887cd
Add generic forEach()
b0fd7e2
Add generic forEach()
6c23704
Improve doc, and use +Inf to cover any delayed start case.
03b60b2
Maybe the max float is preferred over +Inf for CPP?
a197f5c
Merge pull request #16 from HaxeFlixel/dev
IBwWG 262eabb
Merge pull request #22 from HaxeFlixel/dev
IBwWG 2966605
Merge pull request #24 from HaxeFlixel/dev
IBwWG dedca7c
Merge pull request #27 from HaxeFlixel/dev
IBwWG 072baa7
Merge pull request #29 from HaxeFlixel/dev
IBwWG 119aa76
Merge pull request #31 from HaxeFlixel/dev
IBwWG ec69a05
Merge pull request #32 from IBwWG/dev
IBwWG 2d3dd41
Add note about callback timing
IBwWG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This completely bypasses all the timer logic. The user might check properties of the timer on the callback (one of the reasons why it's passed as an argument), and they would be inconsistent with how they would look like on normal completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. I think the method I used for tweens could work here, eh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, looks similarly hacky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(definitely better though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you be more specific? I thought they were dissimilar, otherwise my question of whether to use the other method made no sense... IMO they are dissimilar in that the tweens are
update()
d to the end, which updates all the properties properly (which addressed your concern about bypassing logic, I thought), unlike here where I just called the callback without bothering with any properties.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's a better approach.. a bit unusual, but probably safe. And it might really just feel unusual because it wasn't possible to do this sort of thing before too long ago (you didn't have per-object control of elapsed until that argument was added to update()).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fair enough.
Unfortunately, I have trouble getting it to work the other way:
...this somehow only fires about half my timers, whereas the original approach was working fine for me, somehow.
Really bizarre stuff, because I add them all at once:
But then if I add trace statements:
I get this output, then, having to press a key twice to activate it, which it does in two batches...and still doesn't complete all the timers in the end! :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I don't know what could be causing this. To me, it's still a very useful function as I have it currently in the PR, and it therefore could probably be of use to someone else (after all, there's that undocumented code in there to allow negative numbers of loops...surely that originated the same way ;) ) I propose keeping it, with a caveat, which I've just added, until such time as someone has time to widen its applicability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't iterate on timers while also removing them from the timer array (which
update()
->cancel()
does), if this is the issue here. It's currently an issue in github, but you would have to manuallyonComplete
all the timers and thencancel
all the timers in another loop.It's like when you kill an enemy; you loop through all the enemies, push the dead ones into a temp array, and then loop through the temp array and remove those from the main one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! That makes sense. Thanks for explaining. Maybe a while loop could work here. Unless we want only non-loopers like in the tweens. Then a temp array is the only way to go. Will do.