Skip to content
/ Snake Public

Primer Trabajo Práctico que hice en la Facultad

License

Notifications You must be signed in to change notification settings

SebaB29/Snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game 🐍

Welcome to Snake, a classic arcade game where you guide a growing snake to eat fruits and avoid obstacles. This project is an implementation of the iconic game in Python, developed with object-oriented programming principles.

📜 Table of Contents

🕹️ Features

  • Classic Snake gameplay with growing tail
  • Multiple levels with increasing difficulty and obstacles
  • Random fruit generation
  • Game-over conditions for colliding with obstacles, walls, or the snake's own tail
  • Graphical interface with intuitive keyboard controls

🚀 Installation

To run this project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/SebaB29/Snake.git
  2. Navigate to the project directory:

    cd Snake
  3. Run the game:

    python main.py

🎮 Usage

Use the following controls to play the game:

  • Left Arrow: Move left
  • Right Arrow: Move right
  • Up Arrow: Move up
  • Down Arrow: Move down
  • P: Pause

Avoid obstacles and eat fruits to grow longer!

📷 Images

Img Snake Img Game Over

📁 File Structure

The project structure is as follows:

Snake/
├── graphics/
│   ├── game_render.py
│   └── gamelib.py
├── img/
│   └── [2 demo images of the game]
├── resources/
│   └── obstacles.txt
├── src/
│   ├── constant.py
│   ├── event_controller.py
│   ├── fruit.py
│   ├── game.py
│   ├── obstacle_loader.py
│   ├── obstacle.py
│   ├── program.py
│   └── snake.py
├── .gitignore
├── LICENSE
├── main.py
└── README.md
  • graphics/: Contains libraries for rendering the game (gamelib and custom graphics).
  • img/: Includes demo images showcasing the game's functionality.
  • resources/: Contains the obstacles configuration file (obstacles.txt).
  • src/: Includes source code files for game logic (snake, fruit, obstacles, and game flow).
  • main.py: The entry point of the application.

🛠️ Technologies

This project is built with:

  • Python
  • Gamelib (A library created by the instructor to facilitate the use of threads and rendering for the interface)

🤝 Contributing

Contributions are welcome! If you'd like to improve the game, feel free to fork the repository and submit a pull request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a pull request

📄 License

Distributed under the MIT License. See LICENSE for more information.

📚 About This Project

This project was developed as a practical assignment for university. It aims to implement the classic Snake game using Python, focusing on game logic and graphical interface through object-oriented programming principles.