Share your repls and programming experiences

← Back to all posts
Check Out My Snake Game In Python
h
Glare (229)

Took me a while to create this. Click on the game once and then use the arrow keys to move. Every time you eat an apple, your snake grows in length. If you hit the wall or if the head of your snake hits any part of the body, the game ends. Hope you guys enjoy!

Commentshotnewtop
Glare (229)

Any feedback is appreciated everyone!

Combustion (8)

I think maybe put a "Game Over" at the end instead of just terminating?

Glare (229)

@Combustion This was actually the next step. I'll start on it soon :)

MumboJumboFan (4)

@Glare Maybe have the snake spontaneously combust.

Code1Tech (64)

Wow! Super cool. Deserves a upvote :D

Glare (229)

@Code1Tech Thanks for your support :)

PlaySoccer (40)

why does the snake keep moving even when I let go of the key? Considering how small the map is, it makes the game really hard.

SeamusDonahue (34)

I haven't noticed I like holding the direction, makes me feel faster I guess [email protected]

OLDERTHANYOU (2)

it says directx12 not supported

Glare (229)

@OLDERTHANYOU Did that happen when you were trying to run?

OLDERTHANYOU (2)

@Glare nothing mate.
you should add an exception for "Exception in Tkinter callback"
so when we die we won't see that ugly red error

idrgplayer (30)

HOW DO YOU DO THIS
I THOUGHT I WAS GOOD AT PYTHON xD

Glare (229)

@idrgplayer Break it down bit by bit and it gets easy ;D

yvngpedo (2)

Make it 60 fps for a buttery smooth experience.

PyCoder01 (41)

@yvngpedo It can't be 60 fps cause repl.it is running on a virtual machine

DmitriiPavlov (31)

There is a visual glitch at the bottom right of the screen whenever you eat an apple, you likely update the screen too soon before actually moving it to the right location.

Glare (229)

@DmitriiPavlov So what happens to the apple?

DmitriiPavlov (31)

@Glare I dont know the details of your code, just saying there is a visual glitch that flashes the apple in the bottom left.

Glare (229)

@DmitriiPavlov I'll look into it. Thanks a lot for your feedback :)

WilliamRoss6 (6)

Wow the source code for this is like 80% comments. Anyway, cool game.

Glare (229)

@WilliamRoss6 Glad you liked it :) I do that because sometimes I look back at my code and forget what certain lines are for LOL

WilliamRoss6 (6)

@Glare It's amazing you did this with turtle of all things. You should make a tutorial.

Glare (229)

@WilliamRoss6 Thank you :) That's a great idea, maybe I will!

WilliamRoss6 (6)

@Glare I hope you do. I would definitely like to learn more about turtle because I never really use it.

Glare (229)

@WilliamRoss6 I'm assuming you're using Tkinter?

WilliamRoss6 (6)

@Glare If I do graphics in python I normally use pygame. I don't know how to use Tkinter.

WilliamRoss6 (6)

@Glare Okay, I figured out how to use tkinter, and it's easy enough. Then I tried turtle and it is crazy confusing you need to make a tutorial.

LingWu1 (17)

Cool!I upvoted!

Name12 (134)

Impossible
how can you make such graphic with python!
this is it. the high effort game I was looking for

maybe a game over sign if you lose??
or an option when you click on the snake, it will turn into a rainbow snake that constantly changes color.

BTW, I do know python can produce graphics. I'm no coding Noob (or am I?)

bowmand117 (0)

umm... its so laggy and than it just terminates after i get 1 apple

SeamusDonahue (34)

awesome! unlike most turtle games there is very little input lag! awesome work man!

CodingCactus (3037)

Hi, we've locked this post while we investigate it for cycle farming. If you know of any reason why such a large number of cycleless and pfpless accounts have upvoted this, please let us know (this post is locked so you will need to contact us on a separate post)

CodingCactus (3037)

Looking at it again, it probably isn't farming. Sorry for the trouble

Glare (229)

@CodingCactus No worries. I don't really understand cycles, but anyways...

RayhanADev (344)

@RahulChoubey1 it’s when someone uses numerous accounts to upvote their own post.

RahulChoubey1 (23)

@RayhanADev okay… what if it's to upvote other users' posts that they REALLY like?

RayhanADev (344)

@RahulChoubey1 well... that’s not cycle farming but still not allowed.

RahulChoubey1 (23)

@RayhanADev It's kinda like cheating the rule that each person can only have one upvote

RahulChoubey1 (23)

Also, why is there no downvote?

[deleted]

lol, snake game in python, clever

yvngpedo (2)

How long did I take you to create this?

RAKESHB (0)

I guess the algorithm used isn't that efficient , sp the game is slow. But the color and graphics is very beautiful compared to any snake game.

Glare (229)

@RAKESHB It's a pretty basic game. I think the "slowness" you might be experiencing is from the refresh rate (time-delay) that I set. I'm glad you like the looks though :)

supergavreel (2)

It's a little bit buggy but it's still cool!

hello1964 (22)

It returns an error in the console when I die

Glare (229)

@hello1964 That just means you died. I didn't loop it yet to ask if you want to play again or not.

StanislavKornev (1)

This is really good. How long it took you to create this?

Glare (229)

@StanislavKornev I'm glad you like it :) Took me around a week or two (school was slowing me down a bit).

StanislavKornev (1)

@Glare well school always slows down :)

MumboJumboFan (4)

my computer hates it, I LOVE IT!!!!!!!!!!!!!!

Leroy01010 (369)

omg this isn't slow like the other games!!!

the console is too distracting!!

Glare (229)

@Leroy01010 Just maximize the output screen with your mouse. Glad you like it :)