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

Change self-collision behaviour to be consistent with edge-collision. #2

Merged
merged 1 commit into from
Oct 5, 2021

Conversation

CrazySqueak
Copy link
Contributor

Previously, when you collided with yourself, it would call self.reset() instantly, which would cause the snake to reset to the starting position but would not play the death animation or destroy the old body.
This PR changes it to set self.dead to True, same as how it is done when colliding with screen borders. This causes it to play the death animation and properly reset the snake (same as it does when you hit the screen borders).

Colliding with self now triggers the death animation, instead of
calling self.reset() immediately, which was buggy and caused the snake
to persist between "lives".
@Enjoys-1
Copy link
Owner

Enjoys-1 commented Oct 5, 2021

Thank you for pointing this out.

@Enjoys-1 Enjoys-1 merged commit fca15a7 into Enjoys-1:main Oct 5, 2021
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.

3 participants