Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 5 #23

Open
wants to merge 1 commit into
base: refactor-4
Choose a base branch
from
Open

Refactor 5 #23

wants to merge 1 commit into from

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.

1 participant