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

minimize use of "magic numbers" #4

Open
ASong5 opened this issue Feb 23, 2024 · 0 comments
Open

minimize use of "magic numbers" #4

ASong5 opened this issue Feb 23, 2024 · 0 comments
Labels
refactor Something that needs refactoring (for readability, modularity, efficiency, etc)

Comments

@ASong5
Copy link
Owner

ASong5 commented Feb 23, 2024

    self.hitbox = pygame.Rect(
        self.rect.x + self.image.get_width() / 7,
        self.rect.y + self.image.get_height() * (3 / 4),
        self.rect.width - 2 * (self.image.get_width() / 7),
        self.image.get_height() / 4,
    )

this is a prime example of magic numbers in the code; these numbers should be defined somewhere to impose some sort of meaning upon them + reduce code duplication

@ASong5 ASong5 added the refactor Something that needs refactoring (for readability, modularity, efficiency, etc) label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Something that needs refactoring (for readability, modularity, efficiency, etc)
Projects
None yet
Development

No branches or pull requests

1 participant