Git Product home page Git Product logo

snake_game's Introduction

Snake Game in Python

This Python script implements a classic Snake game using the Pygame library. The player controls a snake that must navigate the game area, collect prizes, and avoid collisions with itself and the boundaries.

Snake Game Preview

Features

  • Snake Movement: Use arrow keys to control the direction of the snake (up, down, left, right).
  • Prizes: Prizes appear randomly on the screen. The snake grows longer and earns points when it consumes a prize.
  • Game Over: The game ends when the snake collides with the boundaries or itself.
  • Score Tracking: Keep track of your score as you collect prizes.

Getting Started

  1. Install Dependencies:

    • Make sure you have Python installed on your machine.
    • Install the Pygame library and colour library, using the following commands:
      pip install pygame
      pip install colour
  2. Run the Game:

    • Execute the script using the following command:
      python snake_game.py
  3. Game Controls:

    • Use the arrow keys to control the snake:
      • UP: Move Up
      • DOWN: Move Down
      • LEFT: Move Left
      • RIGHT: Move Right
  4. Game Over and Restart:

    • The game ends if the snake collides with the boundaries or itself.
    • After a game over, you can restart the game by following the on-screen instructions.

Customize the Game

  • You can customize various aspects of the game, such as the speed of the snake, appearance of prizes, and more by modifying the snake_game.py script.

Contributing

If you have suggestions or find issues with the game, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License

snake_game's People

Contributors

lioil987 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.