Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Run into a problem with two or more sprites changing state simultaneously #54

Open
MKoth opened this issue Dec 6, 2017 · 2 comments
Open

Comments

@MKoth
Copy link

MKoth commented Dec 6, 2017

https://mkoth.github.io/game-kit-example/ - here the example
repository is here - https://github.com/MKoth/game-kit-example
As you can see, after first update of state which happend each 3 sec, for both of sprites, the first spritte loosing fps to 0, while second sprite increasing it.
I guess the problem is with animation subscription in Sprite component, but it can be my bug.
Please, let me know if I'm doing something wrong.
Thank you!

@MKoth
Copy link
Author

MKoth commented Dec 6, 2017

Find out that sometimes its working, need to refresh a couple of times, and wait 3 sec for state to change to see a bug

@MKoth
Copy link
Author

MKoth commented Dec 6, 2017

In Sprite component at function componentWillReceiveProps
commented subscribu, unsubscribe to the animation function, that solved the problem for me. That definetly not the best solution. I guess the problem is the order of subscription unsubscription. First character sprite unsubscribe and trying to subscribe on state change but then, the second characrers sprite interrupt and subscribe itself 2 times leaving first character sprite possibility for subscription. Yet, sprite need to have ability to unsubscribe from animation, so my solution is not solution.

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

No branches or pull requests

1 participant