Skip to content

Reduce animation loading boilerplate.#9

Open
darrenaustin wants to merge 1 commit intoSpellthorn:masterfrom
darrenaustin:animation_boilerplate
Open

Reduce animation loading boilerplate.#9
darrenaustin wants to merge 1 commit intoSpellthorn:masterfrom
darrenaustin:animation_boilerplate

Conversation

@darrenaustin
Copy link
Copy Markdown

@darrenaustin darrenaustin commented Mar 11, 2024

Thanks again for the great series. I noticed that there was a lot of unnecessary boilerplate used to load the animations for the Player and Chicken classes. This PR refactors this to remove the unused fields that stores the animations. As they are only ever referenced in the animations map, they are just cluttering up the class. If they are ever needed for something else in the future, they can be pulled from the animations map.

In addition it is a good practice to declare the type you are using to specify the animations in the map:

class Player extends SpriteAnimationGroupComponent<PlayerState>

That way the compiler can help you with warnings if you try to use something other than a PlayerState for current.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant