Skip to content

Conversation

@michaeltintiuc
Copy link
Member

This is the fifth step of refactoring:

  • Create Player utility functions
  • Create Player constants
  • Cleanup Player navigation and rendering

We've cleaned up the Player's navigation by creating a Vector class that presents the direction of where the player is moving. We're multiplying that directional vector by the SPEED constant and applying the result as top and left position as before, but everything was moved to Player utility functions.
Much like the navigation we've cleanup with the Player rendering by creating two utility functions that help us calculate the proper sprite on the spritesheet based on the Player's direction and current frame.

With this one refactor we've cut down the Player's code almost in half. In the future PRs we're going to further cleanup the Player logic.

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.

2 participants