Closed mitchwadair closed 3 years ago
could also just go one further and remove the first half of the condition since that is a relatively rare case, and only have the right side.
-- since self.animSpeed being 1 is pretty rare, might as well just tank it when it occurs and
-- eliminate the extra check
if self.animSpeed == self.animCounter + 1 then
https://github.com/mitchwadair/sidescroller-framework/blob/f09439b8cada66cef1238bfe3b8d2aae1ecbc54c/src/SFramework/Components/SpriteRenderer.lua#L161
Could improve this by eliminating the division operation (which can be expensive, especially when lots of SpriteRenderers are present).
Even further, we could make it less costly by using an addition operation instead of subtraction
and finally reordering the condition so the least costly option comes first