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

  Рет қаралды 1,161,719

AK Python

AK Python

Күн бұрын

Пікірлер: 1 800
@AKPython
@AKPython 3 жыл бұрын
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()
@shoukonishimiya4007
@shoukonishimiya4007 3 жыл бұрын
ModuleNotFoundError: No module named 'freegames' can you help why this happen
@shootnkill9566
@shootnkill9566 3 жыл бұрын
@@eyepatch6726 how in ubuntu
@AKPython
@AKPython 3 жыл бұрын
Same way on Ubuntu
@pankajjaiswal3930
@pankajjaiswal3930 3 жыл бұрын
@@shoukonishimiya4007 same problem
@mastergamer-qt7gz
@mastergamer-qt7gz 3 жыл бұрын
@@Rajkumar_690 how to install free games in cmd?
@automationtesting3149
@automationtesting3149 3 жыл бұрын
This is the first time I am learning Python and it is really helpful
@rakeshkuruba6286
@rakeshkuruba6286 2 жыл бұрын
bhai can i know the software?
@k_jean
@k_jean 2 жыл бұрын
@@rakeshkuruba6286 vscode
@Gjcbox_Obob
@Gjcbox_Obob Жыл бұрын
It's showing, NameError: name 'head' is not defined. Pls help me😭😭
@aryanmistry6871
@aryanmistry6871 3 жыл бұрын
thanks dude it is easy to understand this for beginners like me
@gamingwithwill4960
@gamingwithwill4960 3 жыл бұрын
Thank god lol I'm 12 and I'm seeing online courses for adults
@faruhathjameel7901
@faruhathjameel7901 3 жыл бұрын
@@gamingwithwill4960 i'm 12 too
@glob711
@glob711 3 жыл бұрын
@@gamingwithwill4960 Dude you guessed my age
@justforfun..6460
@justforfun..6460 3 жыл бұрын
Good joke.. 😂🤣
@faruhathjameel7901
@faruhathjameel7901 3 жыл бұрын
Faruhath Jameel is also one of my accounts . Lol 🤣
@venkateshshanigarapu6673
@venkateshshanigarapu6673 2 жыл бұрын
Explain in detail every point, because some people are not able to understand. And thanks for making this video, keep it up, do more projects
@DeepsikaP
@DeepsikaP 4 жыл бұрын
As a kid i hav always wondered abt how snake eats and moves in snake xenzia!😂
@ponies-p2b
@ponies-p2b 3 жыл бұрын
what should i download to get the game interface separate from the console?
@kutlorenewang9308
@kutlorenewang9308 3 жыл бұрын
kindly assist about the steps to install all needed utilities so that I can begin coding this.
@_ultimate_motivation
@_ultimate_motivation 3 жыл бұрын
How it works my snake is touching the red colour and it was stucking + it doesnt change direction
@deathvalleygaming1083
@deathvalleygaming1083 3 жыл бұрын
from freegames import square,vector ModuleNotFoundError: No module named 'freegames' showing this error
@ANIME_BLITZ_PARADISE
@ANIME_BLITZ_PARADISE 3 жыл бұрын
ya bro same error displaying plzzzzzzzzzzzzzzzz help imma
@AKPython
@AKPython 3 жыл бұрын
Pip install freegames
@speedygod4446
@speedygod4446 3 жыл бұрын
@@AKPython lol
@bombsquadgamers1759
@bombsquadgamers1759 3 жыл бұрын
@@AKPython Pls give link for download
@AKPython
@AKPython 3 жыл бұрын
Just type pip install freegames on your search bar and you will find the package in first
@UniqueSubham
@UniqueSubham 2 жыл бұрын
Its showing error module freegames in third line..... please tell how to correct it... 🥺
@ege.the.engineer
@ege.the.engineer 4 жыл бұрын
on Video : (Incorrect) " onkey(lambda:changes(10,0),'Right') onkey(lambda:changes(-10,0),'Left') onkey(lambda:changes(0,10),'Up') onkey(lambda:changes(0,-10),'Down') " Correct : " onkey(lambda: change(10, 0), 'Right') onkey(lambda: change(-10, 0), 'Left') onkey(lambda: change(0, 10), 'Up') onkey(lambda: change(0, -10), 'Down') "
@Clip_world_1
@Clip_world_1 2 жыл бұрын
which phyton is used make this
@055nithishdanid5
@055nithishdanid5 4 жыл бұрын
Thank u sooo much.🙏..it is working🥳🥳 ...my first game
@mohammedshujath9961
@mohammedshujath9961 3 жыл бұрын
How bro
@ridewithus902
@ridewithus902 3 жыл бұрын
You are so easy learn to everyone that's good work ....keep carry on for work
@lalthakimachhangte9564
@lalthakimachhangte9564 2 жыл бұрын
Very good and basic, easy to understand the basics of coding.
@yatharth8562
@yatharth8562 Жыл бұрын
good
@automationtesting3149
@automationtesting3149 3 жыл бұрын
Really useful information. Keep up the good work!!!
@AKPython
@AKPython 3 жыл бұрын
Share & support
@lehenge_me_wifi8406
@lehenge_me_wifi8406 3 жыл бұрын
@@AKPython sir help
@poke_charninja6633
@poke_charninja6633 3 жыл бұрын
@@AKPython it is shwoing- No module named 'freegames' :-, ( Please help
@therealdefoma
@therealdefoma 3 жыл бұрын
@@poke_charninja6633 me too
@allahdittashahzad5203
@allahdittashahzad5203 2 жыл бұрын
@@poke_charninja6633 yes sir, me too... Please help me in this regard
@ImranAli-us9ml
@ImranAli-us9ml 3 жыл бұрын
It runs smoothly thanks dear
@snktzerotwo8939
@snktzerotwo8939 4 жыл бұрын
Arfan: this code is only 20 lines also arfan: makes 50 lines of code
@Convexly
@Convexly 4 жыл бұрын
lol
@no_name2207
@no_name2207 2 жыл бұрын
it says python turtle graphics not working ..what to do bro
@vihaanpareek5887
@vihaanpareek5887 3 жыл бұрын
When I run this program the letter m is highlighted in red and it displays a message 'Invalid Syntax' . How to deal with this
@jeswanth7851
@jeswanth7851 3 жыл бұрын
change u r syntax to python
@thusith-tec307
@thusith-tec307 3 жыл бұрын
me too
@carsmusicreviews7762
@carsmusicreviews7762 3 жыл бұрын
@@jeswanth7851 sir plz explain how to
@user-yr5gv6qb9v
@user-yr5gv6qb9v 3 жыл бұрын
download visual studio code, go to extensions, and download python extension
@user-km2ir9qy7f
@user-km2ir9qy7f 3 жыл бұрын
You are a life saver. Thank you
@shaileshkanzariya5184
@shaileshkanzariya5184 3 жыл бұрын
Very good editing and explanation 👍
@mghyphenix2621
@mghyphenix2621 3 жыл бұрын
sir mine freegames and vectors are showing problems what to do
@adyant_deepak
@adyant_deepak 3 жыл бұрын
me too
@muhammadabdullah9329
@muhammadabdullah9329 3 жыл бұрын
error ModuleNotFoundError: No module named 'freegames' what is this
@jacobspicknall1355
@jacobspicknall1355 3 жыл бұрын
same I don't know why it does this
@yusuf9829
@yusuf9829 3 жыл бұрын
Same here
@skdr-ff4yp
@skdr-ff4yp 3 жыл бұрын
Bro I know what happened, It needed the module 'Freegames' which is not an inbuilt module. You needed to install it by typing "pip install Freegames' (ignore the quotation mark) in python shell mode.
@syedasurraiyafatima6382
@syedasurraiyafatima6382 3 жыл бұрын
@@skdr-ff4yp from where?
@syedasurraiyafatima6382
@syedasurraiyafatima6382 3 жыл бұрын
Same error plz anyone help me
@sarthaksaxena7920
@sarthaksaxena7920 Жыл бұрын
Bro at my end it was showing that no module like freegames was found 😢
@pracheevarshney2325
@pracheevarshney2325 3 жыл бұрын
I also did this on idle but after pressing run module it showing import error on interactive mode. So what should I do?
@peaceoutgamer1289
@peaceoutgamer1289 2 жыл бұрын
You should do it on Script mode
@Karna.57
@Karna.57 3 жыл бұрын
thanks alot, this helped for my school project alot.
@bombsquadgamers1759
@bombsquadgamers1759 3 жыл бұрын
Thx, now I am able to play game
@progamerzaero9112
@progamerzaero9112 2 жыл бұрын
Guys anyone know how to add score in the game and the game must restart if we lose??
@dhrumilshah7920
@dhrumilshah7920 3 жыл бұрын
In which pad did you make this game??
@tomcat5166
@tomcat5166 3 жыл бұрын
Oh once again my Indian brother! 🤠🤠🤠🤠😎🙏
@realm0dev515
@realm0dev515 4 жыл бұрын
We all could make a game if the scripting language was English
@beethebuilder6191
@beethebuilder6191 4 жыл бұрын
thtere are many people who don't know english
@realm0dev515
@realm0dev515 4 жыл бұрын
No i meant like this Example: Hey computer Make the gun shoot Hey computer Put the object in postion -01,420 +56,56
@harkisingh
@harkisingh 4 жыл бұрын
Hey computer make the game snake.
@realm0dev515
@realm0dev515 4 жыл бұрын
Hey computer Insert a new block in the park
@sivakanthreddy6290
@sivakanthreddy6290 4 жыл бұрын
This will come soon with AI
@kuganrajm
@kuganrajm 3 жыл бұрын
Super explain i subscribed your channel I'm from Tamilnadu
@mightywolfa.b2900
@mightywolfa.b2900 3 жыл бұрын
It is very easy coding form others coding program 💯
@MURALIKrishna-ep4iw
@MURALIKrishna-ep4iw Жыл бұрын
are you using pycharm or which software ? I am currently using intellij IDEA, COde is perfect without any errors but new window is not opening to play game and see the moments, SO please guide me what and all we need to run this
@igorfelipy6277
@igorfelipy6277 4 жыл бұрын
I can't run the code! this work on ubuntu 20.4LTS?
@igorfelipy6277
@igorfelipy6277 4 жыл бұрын
I'm found the bug, in the video the last past of the code is inside the method move(), but the line of code ontimer(move, 100) is the last line of method move()
@igorfelipy6277
@igorfelipy6277 4 жыл бұрын
Here's the documentation with the code rewrited: www.grantjenks.com/docs/freegames/snake.html
@Birdyk-qr9sx
@Birdyk-qr9sx 2 жыл бұрын
Author , this is cool , but this will be cooler if you made a animation for snake
@krpprintpack9804
@krpprintpack9804 3 жыл бұрын
in my program.if we run the program it shows free game is not a module y bro??
@YoungAdonis.
@YoungAdonis. 3 жыл бұрын
same
@kingyt9876
@kingyt9876 2 жыл бұрын
Why an error showing ? ModuleNotFoundError:No module named 'freegames' Please answer
@something234
@something234 3 жыл бұрын
For me it says Traceback (most recent call last): File "C:/Users/admin/Desktop/Game.py", line 3, in from freegames import square, vector ModuleNotFoundError: No module named 'freegames' How to solve please help.
@neuraxbg9865
@neuraxbg9865 3 жыл бұрын
same
@luckybunny_0
@luckybunny_0 3 жыл бұрын
Yss same issue
@vvedhavarshini9702
@vvedhavarshini9702 3 жыл бұрын
@@luckybunny_0 me toooooooo
@shobharaniaade7082
@shobharaniaade7082 3 жыл бұрын
Bro Open Cmd And Type :-- python -m pip install freegames
@HARIRAM-dj3pt
@HARIRAM-dj3pt 3 жыл бұрын
Mee too.. bro
@subhiyoussef5317
@subhiyoussef5317 3 жыл бұрын
hi thanks for your work and keep going
@gavingoesfishing1783
@gavingoesfishing1783 2 жыл бұрын
hey AK!, great video, just wondering, how would you set the borderline for when the snake dies? whenever i run my program the snake dies from an invisible border.
@viniciusporto6088
@viniciusporto6088 2 жыл бұрын
the code in the video is full of mistakes, try the code in the first comment above.
@LifeandLiving2302
@LifeandLiving2302 2 жыл бұрын
@@viniciusporto6088 Hi... I have tried as per mentioned code. But typing third line ie from freegames import square,vector... I am getting error as no module named freegames. What is that
@aaravmukesh2346
@aaravmukesh2346 2 жыл бұрын
@@LifeandLiving2302 if u use pycharm u can just hover over the error 'freegames', and then its will give an install package option, thats what i did and its works
@annaohanyan2524
@annaohanyan2524 2 жыл бұрын
@@aaravmukesh2346 i didn't understand how i can solve the mf problem
@mohammadakmalmeezaansk2017
@mohammadakmalmeezaansk2017 3 жыл бұрын
Which software is that are you using in video
@Sudarshanwadhwan3457
@Sudarshanwadhwan3457 2 жыл бұрын
Hey bro, This really is really helpful for me as I’m also interested in learning Phyton as I’m learning rn and saw your video and clicked on it. But I’ve a question that I’ve 3.10.7 version of Phyton and you’ve 3.7 so is this gonna work in 3.10? Thank you!
@Gjcbox_Obob
@Gjcbox_Obob Жыл бұрын
It's showing, NameError: name 'head' is not defined. Pls help me😭😭
@Sudarshanwadhwan3457
@Sudarshanwadhwan3457 Жыл бұрын
@@Gjcbox_Obob Maybe you forgot to put Semi-Colon.
@Gjcbox_Obob
@Gjcbox_Obob Жыл бұрын
@@Sudarshanwadhwan3457 But this guy hasn't put semicolon in that line. It's showing error in the line-28. In the snake.append(head) part. I've checked the whole code again and again but still I'm not able to figure out where exactly I'm mistaking!!
@justin_havoc1224
@justin_havoc1224 3 жыл бұрын
Does user controls the snake or it just moves to food by condition
@Gombakka
@Gombakka 4 жыл бұрын
It works,wow. It would be perfect with a more detailed explanation
@swamypindy1268
@swamypindy1268 3 жыл бұрын
we can do directly in the idle or any software required to execute
@shaikghousia3991
@shaikghousia3991 3 жыл бұрын
How it works my snake is touching the red colour and it was stucking
@AKPython
@AKPython 3 жыл бұрын
Change the boundary values bro.That may be a reason...
@shaikghousia3991
@shaikghousia3991 3 жыл бұрын
@@AKPython how much we have to give tell me.. I msged u insta also... Ur not seeing.. Plz give Reply in that Friday I have to submit thiz😭😭😭😭😭😭
@salubhai8637
@salubhai8637 3 жыл бұрын
Not running..
@lolitbairiganjan2940
@lolitbairiganjan2940 3 жыл бұрын
How are you displaying this game? you should say where we should write this code. What ide we need to use? And what extra things we need.
@jsstudies6544
@jsstudies6544 2 жыл бұрын
Just save it
@hswathipadmal8454
@hswathipadmal8454 4 жыл бұрын
even after downloading free games from cmd it is telling that:- Traceback (most recent call last): File "C:/Users/admin/Downloads/Snake Game.py", line 3, in from freegames import square,vector ModuleNotFoundError: No module named 'freegames'
@AKPython
@AKPython 4 жыл бұрын
Do you import correctly i mean punctuation & spelling
@narmadabasantia1980
@narmadabasantia1980 4 жыл бұрын
Same problem I have
@adi_subham4871
@adi_subham4871 4 жыл бұрын
Traceback (most recent call last): File "C:\Users\Shubham\Desktop\snake.py", line 3, in from freegames import square, vector ImportError: No module named freegames help me if uhh can plz...
@wrbeasts9030
@wrbeasts9030 4 жыл бұрын
@@adi_subham4871 but did u download all the modules from pip
@wrbeasts9030
@wrbeasts9030 4 жыл бұрын
U have to install modules than use it some moduls dont come on their own u have to load them in
@QUESTIONSPOT
@QUESTIONSPOT 2 жыл бұрын
Light theme, woooooow ^ω^
@AKPython
@AKPython 2 жыл бұрын
😅
@kenilpatel438
@kenilpatel438 3 жыл бұрын
raceback (most recent call last): File "location of file.py", line 3, in from freegames import square, vector ModuleNotFoundError: No module named 'freegames' plz say me how to solve this error plz enybuddy reply me as soon as possible
@akshayjakhal3475
@akshayjakhal3475 3 жыл бұрын
Just type pip install free games in search bar and you will find the pacakge... Then download that package
@RohitKumar-vx3bd
@RohitKumar-vx3bd 3 жыл бұрын
Aapko freegame install krna hoga
@RohitKumar-vx3bd
@RohitKumar-vx3bd 3 жыл бұрын
Pr ho uske baad bhi nhi rah pta nhi kyu
@kenilpatel438
@kenilpatel438 3 жыл бұрын
@@akshayjakhal3475 thx
@kenilpatel438
@kenilpatel438 3 жыл бұрын
@@RohitKumar-vx3bd thx
@annukaul9437
@annukaul9437 3 жыл бұрын
NameError: name 'hideturtle' is not defined .....what to do sir...everyline of code is ok but turtle window is not opened.
@nirnayjaiswal8412
@nirnayjaiswal8412 3 жыл бұрын
my code is only running but i can't see any snake moving around what to do??????
@sumanthakur5442
@sumanthakur5442 4 жыл бұрын
How to run the game It's showing restart........
@bashamshaik
@bashamshaik 4 жыл бұрын
same
@neelamtiwari1028
@neelamtiwari1028 4 жыл бұрын
same
@vishwasgowda2394
@vishwasgowda2394 4 жыл бұрын
@agastya nadella syntaxerror: multiple statements found while compiling a single statement 🤷🏻‍♂😅 What to do bro....
@rizzmangm238
@rizzmangm238 4 жыл бұрын
😬
@Ilsa787
@Ilsa787 4 жыл бұрын
@@vishwasgowda2394Yes copy and paste should work. Its most likely an indentation problem.
@ZxJoshXZs
@ZxJoshXZs Жыл бұрын
No module named 'freegames' (i use pycharm)
@momoahmad966
@momoahmad966 3 жыл бұрын
Hi there! I've got your script correct but I'm still getting no module named "freegames" on my shell please how do I handle that issue?
@guest4911
@guest4911 3 жыл бұрын
even same for me
@vijaysingh-zu7um
@vijaysingh-zu7um 2 жыл бұрын
Download free games library
@muhammadnasehalim1011
@muhammadnasehalim1011 2 жыл бұрын
@@vijaysingh-zu7um from where?
@vijaysingh-zu7um
@vijaysingh-zu7um 2 жыл бұрын
Google
@abdullahnaseer7594
@abdullahnaseer7594 2 жыл бұрын
its a motivational video for beginners to create these type of small projects to enhance their perfection
@kishanthapa5560
@kishanthapa5560 4 жыл бұрын
process finished with exit code 0, then also game is not playing? what to do?
@kishanthapa5560
@kishanthapa5560 4 жыл бұрын
@deadninja its still not running btw i am writing this code in pycharm anyways thanks for helping 👍😃
@kishanthapa5560
@kishanthapa5560 4 жыл бұрын
@deadninja it worked thank you 😊😊
@anujasinghal137
@anujasinghal137 4 жыл бұрын
@deadninja paste it where
@btwitsdiv06
@btwitsdiv06 3 жыл бұрын
sir plz help=(Traceback (most recent call last): File "E:\t game.py", line 3, in from freegames import square,vector ModuleNotFoundError: No module named 'freegames' )
@sivabalarasup7556
@sivabalarasup7556 3 жыл бұрын
type this in Pycharm terminal --> pip install freegames
@alexzen5531
@alexzen5531 3 жыл бұрын
@@sivabalarasup7556 that dosent work
@saifhassan4036
@saifhassan4036 2 жыл бұрын
Same issue bro
@Convexly
@Convexly 4 жыл бұрын
Works Perfectly fine thanks you Sir! subscribed
@AKPython
@AKPython 4 жыл бұрын
You're the one. Keep support & share
@commonthings7817
@commonthings7817 3 жыл бұрын
@@AKPython Does it work in Pycharm?
@AKPython
@AKPython 3 жыл бұрын
Yes it's work on all platforms.but you need to use requirements properly.
@LuqeMax
@LuqeMax 2 жыл бұрын
@@AKPython what are the requitments
@adityadwivedi8798
@adityadwivedi8798 4 жыл бұрын
*For Those Guys Troubling Getting the Code* Source Code - #Snake Tutorial Python import math import random import pygame import tkinter as tk from tkinter import messagebox class cube(object): rows = 20 w = 500 def __init__(self,start,dirnx=1,dirny=0,color=(0,255,0)): self.pos = start self.dirnx = 1 self.dirny = 0 self.color = color def move(self, dirnx, dirny): self.dirnx = dirnx self.dirny = dirny self.pos = (self.pos[0] + self.dirnx, self.pos[1] + self.dirny) def draw(self, surface, eyes=False): dis = self.w // self.rows i = self.pos[0] j = self.pos[1] pygame.draw.rect(surface, self.color, (i*dis+1,j*dis+1, dis-2, dis-2)) if eyes: centre = dis//2 radius = 3 circleMiddle = (i*dis+centre-radius,j*dis+8) circleMiddle2 = (i*dis + dis -radius*2, j*dis+8) pygame.draw.circle(surface, (0,0,255), circleMiddle, radius) pygame.draw.circle(surface, (0,0,255), circleMiddle2, radius) class snake(object): body = [] turns = {} def __init__(self, color, pos): self.color = color self.head = cube(pos) self.body.append(self.head) self.dirnx = 0 self.dirny = 1 def move(self): for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() keys = pygame.key.get_pressed() for key in keys: if keys[pygame.K_LEFT]: self.dirnx = -1 self.dirny = 0 self.turns[self.head.pos[:]] = [self.dirnx, self.dirny] elif keys[pygame.K_RIGHT]: self.dirnx = 1 self.dirny = 0 self.turns[self.head.pos[:]] = [self.dirnx, self.dirny] elif keys[pygame.K_UP]: self.dirnx = 0 self.dirny = -1 self.turns[self.head.pos[:]] = [self.dirnx, self.dirny] elif keys[pygame.K_DOWN]: self.dirnx = 0 self.dirny = 1 self.turns[self.head.pos[:]] = [self.dirnx, self.dirny] for i, c in enumerate(self.body): p = c.pos[:] if p in self.turns: turn = self.turns[p] c.move(turn[0],turn[1]) if i == len(self.body)-1: self.turns.pop(p) else: if c.dirnx == -1 and c.pos[0] = c.rows-1: c.pos = (0,c.pos[1]) elif c.dirny == 1 and c.pos[1] >= c.rows-1: c.pos = (c.pos[0], 0) elif c.dirny == -1 and c.pos[1] 0: continue else: break return (x,y) def message_box(subject, content): root = tk.Tk() root.attributes("-topmost", True) root.withdraw() messagebox.showinfo(subject, content) try: root.destroy() except: pass def main(): global width, rows, s, snack width = 500 rows = 20 win = pygame.display.set_mode((width, width)) s = snake((0,0,255), (10,10)) snack = cube(randomSnack(rows, s), color=(255,0,0)) flag = True clock = pygame.time.Clock() while flag: pygame.time.delay(50) clock.tick(8) s.move() if s.body[0].pos == snack.pos: s.addCube() snack = cube(randomSnack(rows, s), color=(255,0,0)) for x in range(len(s.body)): if s.body[x].pos in list(map(lambda z:z.pos,s.body[x+1:])): print('Your Score is : ', len(s.body)) message_box('You Lost!', 'Play again.....') s.reset((10,10)) break redrawWindow(win) pass main()
@forgandorgan7552
@forgandorgan7552 4 жыл бұрын
line 10 indentation error :(
@mare5161
@mare5161 4 жыл бұрын
@@forgandorgan7552 did you fix that can you help
@hiwab41
@hiwab41 4 жыл бұрын
MaReツ type. def change(x.y):
@sanyasakku
@sanyasakku 4 жыл бұрын
Thx for the code :)
@adityadwivedi8798
@adityadwivedi8798 4 жыл бұрын
@@sanyasakku no problem buddy
@peaceoutgamer1289
@peaceoutgamer1289 2 жыл бұрын
AK bro help me at hideturtle() it says "unindent does not meet outer indentation level"
@svfilms4475
@svfilms4475 4 жыл бұрын
every time I try It don't work..... (help)
@islamictarbiyyah
@islamictarbiyyah 2 жыл бұрын
Really Helpful Thank You Soo Much
@aidangasim
@aidangasim 4 жыл бұрын
it doesnt work,everything is fine no error but doesnt woorkk(((
@DeViLBoYAjAy
@DeViLBoYAjAy 4 жыл бұрын
It works in my laptop.
@Ilsa787
@Ilsa787 4 жыл бұрын
try to copy and paste the code from the first comment. Got it working after fixing the indentations after the for loop.
@bhanikaur6995
@bhanikaur6995 4 жыл бұрын
Sir its giving no error but the game and the turtle window u showed is not being displayed just shell empty.. I tried alot .. pls help out
@mrunalipagare4296
@mrunalipagare4296 3 жыл бұрын
Same problem
@thebest_n
@thebest_n 3 жыл бұрын
in shell show: ModuleNotFoundError: No module named ‘ freegames ‘ it’s error found in 3 line
@Singh-it4hg
@Singh-it4hg 3 жыл бұрын
Nice
@kichu9830
@kichu9830 3 жыл бұрын
Same
@thyvo2356
@thyvo2356 3 жыл бұрын
​@Zohair Sheikh yeah i gotta be honest the 'freegames' didn't work on my laptop. LOL🤔
@hecticcoder1468
@hecticcoder1468 3 жыл бұрын
pip install freegames
@zet5697
@zet5697 3 жыл бұрын
you need to install the module try this in your terminal, "python pip install freegames" or python3 pip install freegames" or just "pip install freegames", do that with every module that doesn't work, you need to install them first
@behappy9988
@behappy9988 3 жыл бұрын
Bro I don't know about coding I just saw yr video...how can I get the python? is python a website or something ?
@nandithak163
@nandithak163 4 жыл бұрын
It's showin invalid syntax in else part pls help
@nischaljha
@nischaljha 2 жыл бұрын
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 🥺
@ShahbazKhan-ip7ut
@ShahbazKhan-ip7ut 3 жыл бұрын
Traceback (most recent call last): File "/storage/emulated/0/💯💯/newfile.py", line 55, in File "/storage/emulated/0/💯💯/newfile.py", line 22, in move update() File "/storage/emulated/0/💯💯/newfile.py", line 15, in inside TypeError: '
@AKPython
@AKPython 3 жыл бұрын
It's a datatype bro check your code otherwise the correct code is already uploaded on Telegram channel kindly check that too
@archanaborade3202
@archanaborade3202 Жыл бұрын
Which software are u using for python
@lucashood5781
@lucashood5781 4 жыл бұрын
Excuse me but what tool did you use to edit and run python code in this video?
@AKPython
@AKPython 4 жыл бұрын
Idle
@lucashood5781
@lucashood5781 4 жыл бұрын
@@AKPython Thanks man
@harshitkharalkar5029
@harshitkharalkar5029 2 жыл бұрын
@@lucashood5781 how can i get idle
@brightlybright5464
@brightlybright5464 2 жыл бұрын
@@harshitkharalkar5029 download it
@PlayStoreUser-iw2sg
@PlayStoreUser-iw2sg Жыл бұрын
to install "random" module u should write "pip install random2"?
@afaqnaveed2602
@afaqnaveed2602 4 жыл бұрын
you didn't tell us to install the packages the turtle freegames and the other
@AKPython
@AKPython 4 жыл бұрын
Actually imported in the top. So I think there is no necessary to say about that.
@Lucifer-0806
@Lucifer-0806 4 жыл бұрын
But where is the freegames library
@SourabhDuharia
@SourabhDuharia Жыл бұрын
Nice one.. i also tried
@dniranjan4017
@dniranjan4017 Жыл бұрын
which compiler should we use to run this code?
@இயற்கை-வ1ல
@இயற்கை-வ1ல 3 жыл бұрын
no wonder you've got so many subs....helped me a lot thanks
@masgar8218
@masgar8218 3 жыл бұрын
Bro after run this program below the red lines how to solve
@forgandorgan7552
@forgandorgan7552 3 жыл бұрын
wut is the prob
@goli.srimedhareddy4554
@goli.srimedhareddy4554 3 жыл бұрын
Yaa
@soumyasingh2526
@soumyasingh2526 3 жыл бұрын
I am not getting any errors but the game isn't starting It just shows Process finished with exit code 0
@mrunalipagare4296
@mrunalipagare4296 3 жыл бұрын
No error but output is not shown after run the program..plz tell what to do? @AK Python
@muhammadamin4484
@muhammadamin4484 3 жыл бұрын
same
@rishabhdehingia6435
@rishabhdehingia6435 3 жыл бұрын
Same😭
@reddylikhith5132
@reddylikhith5132 3 жыл бұрын
Same
@mohammedmuttahir435
@mohammedmuttahir435 Жыл бұрын
Which python software u have used
@hiwab41
@hiwab41 4 жыл бұрын
What are you using to write python projects?
@neldauoggach8208
@neldauoggach8208 4 жыл бұрын
sublime text
@sudhanshu9831
@sudhanshu9831 4 жыл бұрын
idle (interpreter)
@sarveshsuresh5845
@sarveshsuresh5845 3 жыл бұрын
@@neldauoggach8208 its IDLE
@aryaanimesh9018
@aryaanimesh9018 4 жыл бұрын
I have written the code perfectly and it is not even showing any errors but for some reason when i am running the code the game is not showing up. It is only showing python 3.8.6 shell window. Please help..
@dipashrideore2184
@dipashrideore2184 3 жыл бұрын
guys just do this in command prompt: pip install freegames
@joelferdinand4588
@joelferdinand4588 3 жыл бұрын
Thanks
@Muthalib007
@Muthalib007 3 жыл бұрын
@AKPython Which is the application you use in this
@Mr.Mercury_
@Mr.Mercury_ 3 жыл бұрын
He's not a real programmer!!!! dark mode is not on.
@Octo-BoY
@Octo-BoY 2 жыл бұрын
That means you want to say: show off......
@akshaygaikwad2254
@akshaygaikwad2254 2 жыл бұрын
Noobs
@akshaygaikwad2254
@akshaygaikwad2254 2 жыл бұрын
Stop judging
@AKPython
@AKPython 2 жыл бұрын
😁
@williamamaya7168
@williamamaya7168 2 жыл бұрын
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
@TejaswaniARTS7340
@TejaswaniARTS7340 3 жыл бұрын
Sir why because it will be helpful if u can tell means basic program code practice and knowing about a pattern programs
@codebula2421
@codebula2421 3 жыл бұрын
Which editor are you using
@tanaypawar9423
@tanaypawar9423 4 жыл бұрын
There are many unidentified variables tell me solution
@yellownoiseclub
@yellownoiseclub 4 жыл бұрын
i love how hw likes the comment but does nothing to help you
@alkaupadhyay7650
@alkaupadhyay7650 4 жыл бұрын
@@yellownoiseclub Most indian youtubers are like that only
@AKPython
@AKPython 4 жыл бұрын
Sorry for that engaged with work
@alkaupadhyay7650
@alkaupadhyay7650 4 жыл бұрын
@@AKPython If you solve problems of people then no prob
@37.vigneshgopal3
@37.vigneshgopal3 4 жыл бұрын
Bro u use Vs code or wat?? Those r actually functions which the ide thinks as a variable
@shivapatel9132
@shivapatel9132 2 жыл бұрын
Tomorrow is my Board exam and I’m watching this
@rsgameryt5762
@rsgameryt5762 3 жыл бұрын
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): aim.x = x aim.y = y def inside(head): return -200 < head.x < 190 and -200 < head.y < 190 def move(): 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()
@dashgamerzyt9381
@dashgamerzyt9381 2 жыл бұрын
Noice
@pelodecarbono
@pelodecarbono Жыл бұрын
I created the code inside pycharm but it didn't open the graphic screen with snake. what is missing?
@mikhailfischercapablanca9650
@mikhailfischercapablanca9650 2 жыл бұрын
Can you tell the code snippet for highlighting the boundary lines as it will be helpful?
@rverm1000
@rverm1000 3 жыл бұрын
The game displays but there is 3red dots and no movement. I've checked the code line by line. Don't know how to fix it. So I will just experiment to see what happens.
@kashish7408
@kashish7408 4 жыл бұрын
Sir how we can add colour to the background
@janetdeepika360
@janetdeepika360 3 жыл бұрын
["Add colour"]
@virtualthug9252
@virtualthug9252 4 жыл бұрын
It works. Just make sure you add import tkinter on top. So that it will come as a pop-up window.
@AKPython
@AKPython 4 жыл бұрын
Make sure to install all the required things for Performing this script
@kalyanmj6128
@kalyanmj6128 3 жыл бұрын
No errors and no snake window how to solve it
@sunilknight7912
@sunilknight7912 2 жыл бұрын
I'm getting error, on second line, it's showing , no module named 'random' what does it means
@47satvikjayalwal36
@47satvikjayalwal36 4 жыл бұрын
code you displayed is different from the one you ran. Example see the line snake.append(head) head is missing in the code displayed.
@AKPython
@AKPython 4 жыл бұрын
If you want that code join the telegram group ( link in description ). You can get every code that I used on the video. For making videos these kind of errors will be usual.
@mohanj9943
@mohanj9943 3 жыл бұрын
@@AKPython Yup errors and exceptions are family of a coders
@AKPython
@AKPython 3 жыл бұрын
True.
@JyotiPathak2019jcc
@JyotiPathak2019jcc 4 жыл бұрын
Great sir...Thanks a lot😄
@AKPython
@AKPython 4 жыл бұрын
Share & support
@JyotiPathak2019jcc
@JyotiPathak2019jcc 4 жыл бұрын
@@AKPython Sure Sir...
Tic Tac Toe Game project using Python (Ursina engine)
10:55
AK Python
Рет қаралды 12 М.
What does '__init__.py' do in Python?
6:50
Indently
Рет қаралды 55 М.
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 14 МЛН
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 25 МЛН
Make a Clock using Python | Python Project
4:32
Coding With Evan
Рет қаралды 1 МЛН
Python Projects Ideas - 11 Awesome Games You Can Make With Python
10:46
Learn Python by Building Five Games - Full Course
6:43:43
freeCodeCamp.org
Рет қаралды 3,1 МЛН
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 586 М.
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,4 МЛН
How to create a Pong Game using Python in 6 minutes
10:34
AK Python
Рет қаралды 261 М.
Python for Beginners - Learn Python in 1 Hour
1:00:06
Programming with Mosh
Рет қаралды 19 МЛН
15 Python Projects in Under 15 Minutes (Code Included)
12:37
Tech With Tim
Рет қаралды 2 МЛН
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 14 МЛН