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.
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 theanimations
map.In addition it is a good practice to declare the type you are using to specify the animations in the map:
That way the compiler can help you with warnings if you try to use something other than a
PlayerState
forcurrent
.