Skip to content

barkhapathak/snake_game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Simple Snake Game A fun and easy-to-play Snake Game made using Python. Itโ€™s a great project to see how computer logic and graphics work together.

๐ŸŽฎ How to Play Start: Run the Python file.

Move: Use your Arrow Keys (Up, Down, Left, Right).

Goal: Eat the Red Apples to get points.

Rules: - Every time you eat, you grow longer.

Don't hit the walls!

Don't bite your own body!

๐Ÿ’ก How it Works (Simple Logic) ๐Ÿ“ 1. The Map (Coordinates) The game sees the screen as a grid of small squares.

X moves you side-to-side.

Y moves you up and down.

Note: In coding, Down is Plus (+) and Up is Minus (-).

๐Ÿ 2. Moving the Snake The snake doesn't actually "slide." Instead, every split second:

It adds a new block at the front (where it's going).

It removes the last block from the back. This makes it look like the snake is moving!

๐ŸŽ 3. Eating and Growing When the snake's head touches the apple:

We add the new block at the front.

But we don't remove the block from the back.

Result: The snake gets longer by one block!

๐Ÿ’ฅ 4. Game Over The game stops if:

You go off the edge of the screen.

The head touches any other part of the snake's body.

๐Ÿ› ๏ธ Tech Used Python.

Tkinter: The tool used to draw the game window and snake.

๐Ÿš€ Want to change the game? Look at the top of the code! You can change:

SPEED: Lower number = Faster game.

SNAKE_COLOR: Change "green" to your favorite color.

GAME_WIDTH: Make the box bigger or smaller.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages