Skip to content

Cleared up the code#1

Open
FabianSt305 wants to merge 2 commits intoclear-code-projects:mainfrom
FabianSt305:patch-1
Open

Cleared up the code#1
FabianSt305 wants to merge 2 commits intoclear-code-projects:mainfrom
FabianSt305:patch-1

Conversation

@FabianSt305
Copy link
Copy Markdown

You said yourself that you had trouble with the draw_snake logic.
As it now simply looks up the right texture using a dict, it should be a lot easier to understand and reason about.

Using Vector2 from vec instead of the pygame version because it supports hashing.
Instead of checking each coordinate one at a time, draw_snake does some math and looks up the correct texture in a dict called self.graphics
@igormcsouza
Copy link
Copy Markdown

LGTM

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