Code Monkey home page Code Monkey logo

snake-python's Introduction

How to code a snake game in Python for beginners! Learn how to create a game of snake in Python using tkinter graphics library. Throughout the tutorial, you will learn how to create a graphical user interface (GUI) to display the Snake game, create the game loop, listen for Key presses to move the snake, use a list to store the snake's segments, and check collision and out of bounds for game over.

How to setup Python with Visual Studio Code

snake-python-demo

Homework:

You can continue working on this project if you like. One feature you can add is a keyListener in change_direction to restart the game every time there is a game over. ex) if (e.keysym == "space" and gameOver). Inside this conditional statement, you should reset the game to default (clear snake_body, set velocityX, velocityY, score to 0, etc). Another feature you can add after this is keep track of the high score and paint it below the current score. For this you will need a variable to keep track of high score.

snake-python's People

Contributors

imkennyyip 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.