fixed gene sprites not loading#11
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the
src/sprite_manager.pyfile to improve code clarity and type safety, particularly regarding dragon sprite retrieval and color constants. The main changes involve moving color constant imports to the module level, improving function signatures withOptionaltyping, and ensuring that stage values are always handled as strings.Improvements to imports and code organization:
DRAGON_RED,DRAGON_BLUE, etc.) from inside methods to the top of the file, reducing redundancy and improving import clarity. [1] [2] [3]Type safety and function signature improvements:
Optionaltyping forstage,dragon_type, andenchantments, making the code more robust and type-safe. [1] [2]stageis always treated as a string withinget_dragon_sprite, reducing the risk of type errors.Bug fixes and fallback improvements:
_create_pixel_art_spriteinstead of the deprecated_create_placeholder_sprite.get_dragon_with_enchantmentsto always use the dragon's current stage, ensuring correct sprite selection.Minor interface changes:
_load_sprite_from_filetoOptional[pygame.Surface]to better reflect cases where loading may fail.get_spriteto use the newactual_stagevariable, ensuring consistent stage handling.