Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Python Course - Doing Snake Game with Turtle Module
Rating: 4.9 out of 5(6 ratings)
2,031 students

Python Course - Doing Snake Game with Turtle Module

Snake Game with Python, Python Turtle Module, Learn Python
Last updated 2/2022
English

What you'll learn

  • You will be able to do games by using Turtle Module.
  • Can use "Class" to make projects.
  • Learn how to write your own Python programs and put them together.
  • Be familiar with the Python programming language.
  • Be confident in your Python programming abilities and knowledge so that you may apply for Python programming jobs.
  • Use Python to make your daily life easier.
  • You will learn Turtle Module very well.

Course content

1 section17 lectures1h 58m total length
  • Screen Setup3:02
  • Creating a Snake Body4:45
  • Creating a Snake Body by using loop2:48

    Create a snake body by looping through a list of positions to generate segments. Start with three segments and let the body grow as the snake eats.

  • Move the Snake Segments3:31
  • Makes the Snake move as a whole4:58

    Make all snake segments move as a unit in Python turtle by using screen.tracer(0) and screen.update with timing delays.

  • Make Tail follow the Head9:37

    Learn how to make the snake's tail follow the head in a Python turtle snake game by updating segment positions, using range for segments, and calculating new coordinates.

  • Create a Snake Class7:38

    Learn to create a snake class in Python using the turtle module, initialize a three-segment snake, manage movement and direction, and structure code across multiple files for a snake game.

  • Control the snake with keypress10:08

    Learn to control the snake with arrow keys, binding up, down, left, and right, prevent reversing direction, and use the head to manage heading efficiently in a turtle-based snake game.

  • Create food11:12

    Define a food class as a turtle subclass, place it randomly on the screen, and manage its color, coordinates, and pen behavior using a fixed-step random approach.

  • Detect collision2:59

    Use a distance method to detect collision between the snake head and food; when the distance is under 10, reposition the food via a refresh method with random coordinates.

  • Create Scoreboard9:18

    Create a scoreboard class using turtle inheritance, initialize the score at zero, and update it by increasing the score when food is eaten, clearing and redrawing the display.

  • Detect collision with wall14:14
  • Extend the body5:56
  • Detect collision with body7:18

    Detect collision with the snake's body by comparing the head to each tail segment and checking distance below a threshold; use segment slicing to ignore the head and trigger game over.

  • Fix the bug with the wall4:34

    Fix the wall collision bug by improving screen exit behavior and extending the y coordinate limit, so the snake can approach the wall without game over.

  • Fix the bug with Changing direction9:49

    Refine direction changes in the turtle snake game by adding segment coordinate checks to prevent illegal turns, making the game playable.

  • Convert Py File to executable file6:41

    Convert your Python snake game project into a single executable using PyInstaller, bundling the main file and required scripts so friends can run it without Python installed.

Requirements

  • You should know the basics of Python knowledge.

Description

Python is a programming language that is intended for both total beginners who have never coded before and experienced programmers who wish to broaden their career choices by learning Python. In reality, Python is one of the most widely used programming languages in the world, with major corporations such as Google using it in mission-critical systems such as Google Search to great effect. Python, on the other hand, is the most popular programming language for machine learning, data science, and artificial intelligence. If you want to get one of those high-paying positions, you'll need to be an expert in Python, which is exactly what you'll learn from this course.

You will master the Turtle module with the Python programming language in this course. Firstly, we will learn the basics of the Turtle Module, and then we will make a Snake Game by using the Turtle Module. In this way, you will understand how the "class" works in Python.

Once you've completed the course, you'll be ready to submit applications with confidence for Python programming positions. And sure, this is true even if you have never coded in your life before now. You may become employable and useful in the eyes of future employers if you have the appropriate abilities, which you will acquire in this course and practice.

If you have any questions about this course, please contact me as soon as possible and I will respond to you the same day. With the help of this course, you will learn how to make your lives simpler by becoming familiar with the Python programming language. This will keep you motivated on a daily basis and prevent you from becoming bored while studying Python.

Who this course is for:

  • Who want to learn Turtle Module.
  • Who want to learn OOP very well.
  • Who want to learn Python in an effective way.
  • Who want to communicate with computer.
  • Who want to use Python skills to get better jobs.