Project Description
Simple Snake
A great first attempt at PyGame
While this was supposed to be an in-console game, that just seemed to restricting with all the options that Python presented.
Simple Features
- Sound Effects
- Hand Drawn Apple
How I Built It
As previously stated, I took advantage of PyGame. The only problem was that my knowlegede of PyGame was not as extensive as I needed it to be. So I did what all great developers do.
Seek a tutorial. Special thanks to this video for helping me out.
Some Notable Pieces of Code From This Project
Three Classes Controlling Everything
class SNAKE: ...
class FRUIT: ...
class MAIN: ...
Great Use Of If Statements
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
if main_game.snake.direction.y != 1:
main_game.snake.direction = Vector2(0, -1)
if event.key == pygame.K_DOWN:
if main_game.snake.direction.y != -1:
main_game.snake.direction = Vector2(0, 1)
if event.key == pygame.K_LEFT:
if main_game.snake.direction.x != 1:
main_game.snake.direction = Vector2(-1, 0)
if event.key == pygame.K_RIGHT:
if main_game.snake.direction.x != -1:
main_game.snake.direction = Vector2(1, 0)
Give Feedback
Log in to comment!