| How to create a Snake game using python | | AK python | - playproduction.de

| How to create a Snake game using python | | AK python |

AK Python
Views: 783566
Like: 17215
In this video we are going to see about how to create a snake game using python

We are using three libraries to create this epic game that is turtle, random and freegames

Snake game is an epic game. And it provides so many past moments to you

Download freegames:

* If You get impressed with my work Then Buy me a cup of coffee:

If you want the source code then subscribe our telegram channel :

Ask your doubts :

keep support me to get 10K subscribers❤

Thanks for watching ..!

Tags:
#snakegame #snakegamecode #python #akpython

All the videos, songs, images, and graphics used in the video belong to their respective owners and I or this channel does not claim any right over them.

Copyright Disclaimer under section 107 of the Copyright Act of 1976, allowance is made for “fair use” for purposes such as criticism, comment, news reporting, teaching, scholarship, education and research. Fair use is a use permitted by copyright statute that might otherwise be infringing.”

95 Comments

  1. It is saying that there is no module named "freegames"..?🥵

  2. How to add freegames module…..?
    Pls help😔

  3. Bro have all done but when I click runmondule the turtle graphics is not comming

  4. Hey man i cant start the code becouse it say "No module named 'freegames'" and this is my first game so please answer soon

  5. Which softwares to be download for this??

  6. Everything is done but there is much errors
    I try to copy your comment and paste it in vs code but same errors occurred.
    Please help me 🥺

  7. When i run it it is giving unindent does not match any outer indention level so what i do ☹️

  8. Module not found error no model named free games please give solution

  9. from freegames import square, vector

    Please give me the solution. i faced a error in this line

  10. Sir this codes are working(compile) but I cant able to see the output(no run)
    What can I do now….

  11. Very good and basic, easy to understand the basics of coding.

  12. Hi, i wanted to know if there is a way i can make a score counter for this.
    Can you help me for this?

  13. I have a problem, I typed everything excatly the same but when pressing 'run' it says

    ModuleNotFoundError: No module named 'freegames'

    What to do?

  14. im sorry to bother you but it says no module freegames

  15. I'm trying to do it with Google colab, but it does not recognize the module freegames (the other two modules have no problem). Any idea? thank you

  16. I'm getting error, on second line, it's showing , no module named 'random' what does it means, plzzz help

  17. Code is not running, it's writing no module named freegames

  18. I cant install freegames module what can i do

  19. i have followed every step but when i run the code nothing happens

  20. Kuch bhi clr nhi dikh raha or yeh kaise start kiya yeh toh btaya hi nhi I mean kon si application mai open kiya hua hai

  21. @AK Python NameError: name 'false' is not defined how to fix that ???

  22. @AK Python NameError: name 'false' is not defined how to fix that

  23. NameError: name 'false' is not defined how to fix that

  24. NameError: name 'false' is not defined how to fix that plzz ????

  25. from freegames import square,vector

    ImportError: No module named freegames

  26. there is no source like freegames what are you trying to do here

  27. Still an error sir….Name error name 'head' is not defined…… Why..? it's already defined toh na…..

  28. AK bro help me at hideturtle() it says "unindent does not meet outer indentation level"

  29. Hi Bro the code ran successfully but how to start and control the game. The control key??

  30. Hey there AK! Would you mind using Tkinter in a video next time? (This is just a video request and not a demand)

  31. And at the end I realized I don't have that freegames module🤦‍♀️🤦‍♀️🤦‍♀️

  32. An error is showing that there is module name "freegames" exit.

    What should I do now ?

  33. when i run it it it says vector not defined

  34. Full code:

    from turtle import *
    from random import randrange
    from freegames import square, vector

    food = vector(0, 0)
    snake = [vector(10, 0)]
    aim = vector(0, -10)

    def change(x, y):
    "Change snake direction."
    aim.x = x
    aim.y = y

    def inside(head):
    "Return True if head inside boundaries."
    return -200 < head.x < 190 and -200 < head.y < 190

    def move():
    "Move snake forward one segment."
    head = snake[-1].copy()
    head.move(aim)

    if not inside(head) or head in snake:
    square(head.x, head.y, 9, 'red')
    update()
    return

    snake.append(head)

    if head == food:
    print('Snake:', len(snake))
    food.x = randrange(-15, 15) * 10
    food.y = randrange(-15, 15) * 10
    else:
    snake.pop(0)

    clear()

    for body in snake:
    square(body.x, body.y, 9, 'green')

    square(food.x, food.y, 9, 'red')
    update()
    ontimer(move, 100)

    hideturtle()
    tracer(False)
    listen()
    onkey(lambda: change(10, 0), 'Right')
    onkey(lambda: change(-10, 0), 'Left')
    onkey(lambda: change(0, 10), 'Up')
    onkey(lambda: change(0, -10), 'Down')
    move()
    done()

Leave a Reply

Your email address will not be published.