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

scene.tweens.killTweensOf(myArray, myObject) doesnt kill tweens on myArray objects #6016

Closed
michalfialadev opened this issue Feb 19, 2022 · 2 comments

Comments

@michalfialadev
Copy link

michalfialadev commented Feb 19, 2022

Ive got some container objects im running tweens on, and an array of container objects im running tweens on. Then always before i start running these tweens, i call killTweensOf on all of those objects, to ensure they are cleared (in case tweens are already running on them), like this:
myScene.tweens.killTweensOf([ this.screenOverlay, this.categoryButtons, this.closeBtn ]);
The above code does not clear the running tweens on categoryButtons, which is an array of buttons, which are tweened with a stagger. However, the way i run tweens on those buttons is that i simply put them into targets like this:
targets:this.categoryButtons

The following code does clear those tweens running on those buttons:
myScene.tweens.killTweensOf([ this.screenOverlay, ...this.categoryButtons, this.closeBtn ]);

But it conflicts with the way one would think it should work (spread or iteration to happen automatically on Phaser's side - just like in case when we define tweening [we do not have to use targets:[...this.categoryButtons] there).

EDIT: I just noticed that killTweensOf([]) is called on an array of objects, so prob. thats why Phaser does expect it to be already an array of individual objects, not an array of arrays of arrays... to process the objects recursively. Feel free to close the issue, if its a moot point.

@photonstorm
Copy link
Collaborator

I'm not going to close this, instead, I'll leave it as a feature request, because it's working as it should currently, but could be expanded so it can take arrays as well.

@photonstorm
Copy link
Collaborator

Thank you for submitting this feature request. We have implemented this, and the feature has been pushed to the master branch. It will be part of the next release. We would appreciate it if you get time to build and test it for yourself.

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

No branches or pull requests

2 participants