There seems to be constant sprite creation/destruction in this file.
This is in the update loop and not the draw loop, so it's fairly negligible.
Even if it doesn't affect performance, it makes debugging dispose methods (removing event listeners, children, etc) annoying because they're constantly being fired.
Proposed solution:
Create a mapping of: Sprite Path => Sprite Node
Check if map contains the sprite node we want. Create it if it doesn't exist.
Hide previous visible sprite node and show the new active sprite.
There seems to be constant sprite creation/destruction in this file.
This is in the update loop and not the draw loop, so it's fairly negligible.
Even if it doesn't affect performance, it makes debugging dispose methods (removing event listeners, children, etc) annoying because they're constantly being fired.
Proposed solution: