-
Notifications
You must be signed in to change notification settings - Fork 495
Description
See my original comments for a more detailed explanation: #2978 (comment), #2978 (comment)
TL;DR: Matrix recalculations every frame, per sprite, take up a significant chunk of time in the draw() call (~60%), which can get problematic with many sprites displayed
I've played around with it a bit, and with some tricks I've managed to shave down the time taken by around ~90%. It's quite hacky though: ACrazyTown@fda8f29. I've managed to do so by querying the screen position only once per draw() (with a helper point) instead of twice in both isOnScreen() and prepareComplexMatrix(), and avoiding various FlxPoint helper methods and getters/setters.
What I haven't played around with is recalculating the matrix on demand, i.e. only doing it when the sprite is moved or rotated