Python Game Programming: Simple Cookie Clicker

Поділитися
Вставка
  • Опубліковано 8 лис 2024
  • In this video I show you how to make a simple Cookie Clicker clone in just 22 lines of code!
    Download the Code and Image Here: github.com/wyn...
    📖 DOWNLOAD my FREE Intro to Python eBook here: drive.google.c...
    📖 DOWNLOAD my FREE Intro to Java eBook here: drive.google.c...
    NEED HELP?
    🆘 If you need help, please copy and paste your code into a comment along with any error messages. I'll take a look when I'm able and get back to you.
    LINKS
    🗄️ GITHUB: github.com/wyn...
    💬 Follow me on Twitter: / tokyoedtech
    📝 Check out my Blog: christianthomp...
    ⬇️ Download Geany Editor: www.geany.org
    LEARN MORE PYTHON
    ➡️Space Invaders: • Python Game Programmin...
    ➡️Snake Game: • Python Game Programmin...
    ➡️Pong: • Python Game Programmin...
    ➡️Space War: • Python Game Programmin...
    ➡️Intro to Python (for Java Coders): • Intro to Python for Ja...
    ➡️Space Arena - The Ultimate Python Turtle Graphics Game Tutorial: • Ultimate Python Turtle...
    LEARN MORE JAVA
    ➡️Basic Java for Beginners: • Basic Java 1&2: Commen...
    ➡️Intro to AP Computer Science A: • AP Computer Science Un...
    #Python #Game #Tutorial
  • Наука та технологія

КОМЕНТАРІ • 624

  • @benshapiroeatscrack8865
    @benshapiroeatscrack8865 3 роки тому +2

    Best coding teacher on UA-cam! I nailed this tutorial and was surprised I was able to keep up. He doesn't go too fast like everyone else. Perfect speed and explanations!

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Thanks - I try! Keep on codin'!

  • @bar___
    @bar___ 3 роки тому +1

    You are so much better than the other tutors around, some I can't even listen to... I hope you make lots more content for beginners like me.

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Thanks - I try. Keep on codin'!

  • @edvardgaare-olstad8545
    @edvardgaare-olstad8545 3 роки тому +3

    Thanks I had to make a game for school but i added more stuff like grandma's and cursors thanks to you!

  • @elliottsherbourne5812
    @elliottsherbourne5812 3 роки тому +2

    you can by upgrades so you can get more cookies a click, and you can get an auto clicker where it gives you cookies automatically. It costs cookies to buy these upgrades btw

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Cool - I didn't know that. It's a good exercise for you to try.

  • @owensheasby
    @owensheasby 2 роки тому +2

    Wow, awesome man! Simply explained and it works. Thanks i wish you well and good luck in the new year

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      Thanks - glad you liked it. Keep on codin'!

  • @Cedar-Collins
    @Cedar-Collins Рік тому +3

    Thank you so much for this helpful video! I'm looking for inspiration for a school project and this feels like something I can work with!

    • @TokyoEdTech
      @TokyoEdTech  Рік тому +1

      You're quite welcome. Good luck with your project and keep on codin'!

  • @thegrowthmindsetshow6400
    @thegrowthmindsetshow6400 7 місяців тому

    Got it to work on Windows 10. Thanks for the clear tutorial! It took me a little bit to figure out the pathing on windows for the cookie picture, and how to reposition the clicks text so it was within the window. Solution to the first problem is to make sure the slashes are / instead of \ that windows provides when looking at the location of the file in the properties. the solution to the second problem was the change pen.goto(0, 400) to pen.goto(0, 200). Simple, I know, but I'm new to python and I didn't know what I didn't know. Thanks again!

    • @TokyoEdTech
      @TokyoEdTech  7 місяців тому

      You're quite welcome - glad to hear you got it working! Keep on codin'!

    • @gigisme7
      @gigisme7 6 місяців тому

      Thanks this was really helpful for me. Do you know why changing 400 to 200 makes a difference? I couldn't figure it out

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      @@gigisme7 The default window size varies from Python version to Python version.

  • @oreocat2884
    @oreocat2884 Рік тому +2

    This was a great tutorial im very VERY new to python and this was super fun to see something visual.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому +1

      Thanks - really glad I could help!

  • @mailmonkey
    @mailmonkey Рік тому +2

    this was really helpful and I expanded and added a shop with upgrades!

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Awesome - that is how you learn to code! Learn the basics then experiment with your own ideas. Keep on codin'!

  • @gaelmanildo9728
    @gaelmanildo9728 3 роки тому

    Hello, I've been watching your videos and so far I managed to get the Pong and Snake games going, it felt awesome to see myself creating something so cool with your help.
    Now I see this new function "register shape" and I was wondering if I could use it on those other games to improve some visuals.
    Thank you very much, I really appreciate the time you take to make these tutorials and keep up with the comments section!

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому +1

      Glad I could help! Yep - definitely can use it on the other games - for example, you could make better looking paddles and ball for pong.

  • @MotivationalMind-XXX
    @MotivationalMind-XXX Рік тому +1

    Thank u this was my first python game ever u explained it well and After trial and error i made it

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      You're welcome - glad to hear it. Keep on codin'!

  • @colwarsstudiobrickfilmandm8580
    @colwarsstudiobrickfilmandm8580 3 роки тому +1

    This is very good code. You would be great at making gameboy games. Because they have almost no memory & you need to make a lot of shortcuts! They run a z80 microprocessor (its very similar) there is almost no practical use for learning z80... But you can still have loads of fun!

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Thanks - I really miss the old days. Check out my 6502 assembly intro video; you might find it interesting.

  • @dj3236
    @dj3236 2 роки тому +1

    This is the best video ever! Thank you so much for showing me how to make a simple game in python.

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Thanks - much appreciated! Keep on codin'!

  • @PianoHypnoshroom
    @PianoHypnoshroom 3 роки тому +2

    This question is a little off-topic, but how much Japanese do you know?
    You've said that you live in Tokyo, and I find that you often use terms like "yosh/yoshi".

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      I'm pretty good in day to day conversation, but can't read or write all that well.

  • @Harpreet06
    @Harpreet06 3 роки тому +3

    I thought mine wasn't working but I just had to make my window bigger haha

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      It's the little things that get you!

  • @saeli030
    @saeli030 6 місяців тому +1

    Hello, I saw your video recently and I liked it. I'm doing it for a school project in "replit" but I can't get the image to show, what can I do?

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      Sorry, I'm not sure about repl.it - I recommend coding on your computer. It's helpful to know how files and folders are organized.

  • @BL1Z33
    @BL1Z33 Рік тому +1

    The pen didn't work for me (using Windows 10) so I replaced all instances of the pen.write() with print(f"Clicks: {clicks}"). Other than that, amazing tutorial! You just earned a sub.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому +2

      Try moving the pen down a bit - pen.write might be drawing it off the visible part of the screen.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Try pen.goto(0, 100) instead of 250.

  • @milkerrman
    @milkerrman 2 роки тому +2

    AHH I LOVE YOUR CONTENT SO MUCH😭

  • @shagundeogharkar6252
    @shagundeogharkar6252 3 роки тому +2

    181st comment , keep up the good work bro!!

  • @mishka5169
    @mishka5169 3 роки тому +1

    Nice video! :D
    I was wondering if you have any videos or could do one on making a sprite in python or the basics of a customizing game?

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      That's an interesting one, but I'm not sure how to go about it...

    • @mishka5169
      @mishka5169 3 роки тому

      @@TokyoEdTech Oh ok, that's fine, you have other very helpful tutorials already :)

  • @corrupt3047
    @corrupt3047 3 роки тому +1

    Thanks lol , i’ve been trying to do this by myself for a bit and couldn’t get it and i was able to get the first parts done before watching tutorial but then i just wasn’t able to do the last bit

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Glad I could help - keep on codin'!

  • @cw3dv
    @cw3dv 3 роки тому +1

    Great
    Which video editor do use

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      I don't edit my videos - I just record using OBS studio.

    • @cw3dv
      @cw3dv 3 роки тому

      @@TokyoEdTech Ok Great

  • @Chris-ob3hv
    @Chris-ob3hv 7 місяців тому +2

    Can I use this in VS Code? I wanted to do this for a school project

  • @fatpengu_
    @fatpengu_ 3 роки тому +5

    Finally... A worthy UA-cam tutorial...
    Your day is gonna be lucky if you saw this ;)

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому +1

      Cheers!

    • @fatpengu_
      @fatpengu_ 3 роки тому

      @@TokyoEdTech Cheers!

    • @wokk9543
      @wokk9543 3 роки тому

      no its not i dont use linux it dosent even work on windows

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      It should work just fine on Windows. You may have to include the full path for the image though.

    • @wokk9543
      @wokk9543 3 роки тому

      @@TokyoEdTech ok i will try

  • @first_name_last_name4560
    @first_name_last_name4560 3 роки тому +2

    This is great! Thanks man

  • @LuisLozano
    @LuisLozano Рік тому +1

    first time evr its worked! i popped my cookie here! thanks! ill never forget....sob sob...

    • @TokyoEdTech
      @TokyoEdTech  Рік тому +1

      Glad to hear it - keep on codin'!

  • @snosbd
    @snosbd 6 місяців тому +2

    Why doesnt the clicks show for me im using jupyter notebook

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      I'm not sure - I haven't tried this on Jupyter notebook.

  • @itzrepey
    @itzrepey 3 роки тому +1

    Hello, I did everything and almost everything works, but I don't see the clicks?

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      I'll need to see the code to help.

  • @N1KJR
    @N1KJR 4 місяці тому +3

    This looks easy.
    But I have to try it

  • @zoroo26
    @zoroo26 Рік тому +3

    haha its been 2 years and you still replying to the comments! W rokyo

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Thanks - I try to keep an eye on things when I can...keep on codin'!

  • @hexortime
    @hexortime Рік тому

    Thank you so so much for this, very simple and fun

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      You're welcome... glad to hear it! Keep on codin'!

  • @yuno833
    @yuno833 2 роки тому +3

    Great video, works well. Can you please make a video on how to add sounds and animations to it?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      Thanks - would be happy to when I have time.

  • @frogntoad3134
    @frogntoad3134 2 роки тому +2

    Its guys like Kevin that keep us going

  • @hakor_
    @hakor_ 2 роки тому +2

    OMG I am sooo proud of myself :).

  • @elliottsherbourne5812
    @elliottsherbourne5812 3 роки тому +2

    THANKYOU SO MUCCHH!!! :D

  • @NoOne-wi7tu
    @NoOne-wi7tu 2 роки тому

    Can You make videos about adding upgrades to click, or something else that would fit in Clicker Game?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Possible someday - if you shoot me a reminder in summer I might have time then!

  • @randomacc7732
    @randomacc7732 3 роки тому +1

    Hey I'm wondering something, is making programs like this for personal use legal? Sorry I'm new

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      It's good to ask those types of questions. Yes, for personal use you can do pretty much what you want - it's called fair use.

  • @yoshihome
    @yoshihome Годину тому

    help, when I try to add the cookie sprite, it says "couldn't open "cookie.gif": no such file or directory"

    • @yoshihome
      @yoshihome Годину тому

      here's my code:
      import turtle
      wn = turtle.Screen()
      wn.title("Cookie Clicker by @yoshihome")
      wn.bgcolor("black")
      wn.register_shape("cookie.gif")
      cookie = turtle.Turtle()
      cookie.shape("cookie.gif")
      cookie.speed(0)
      wn.mainloop()

  • @pradeeptangar
    @pradeeptangar 3 роки тому +14

    9th comment, I'm a ultra legend.......😅😅😅

  • @messi-arg1
    @messi-arg1 2 роки тому +2

    Bro I pasted the exact same code you wrote but,, the pen doesnt show anything.. im using python 3.9

    • @messi-arg1
      @messi-arg1 2 роки тому

      import turtle
      import time
      wn = turtle.Screen()
      wn.title("Cookie Clicker")
      wn.bgcolor("black")
      wn.register_shape("cc.gif")
      cookie = turtle.Turtle()
      cookie.shape("cc.gif")
      cookie.speed(0)
      clicks = 0
      pen = turtle.Turtle()
      pen.hideturtle()
      pen.color("white")
      pen.penup()
      pen.goto(0, 400)
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      def clicked(x, y):
      global clicks
      clicks += 1
      pen.clear()
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      cookie.onclick(clicked)
      wn.mainloop()

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      Can you share the code here? And any error messages?

    • @messi-arg1
      @messi-arg1 2 роки тому +1

      @@TokyoEdTech I dont get any error messages but when I try turtle.write instead of pen it works /

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      @@messi-arg1 There is likely a problem with your code - if you share it, I can take a look.

  • @erinm4605
    @erinm4605 2 роки тому +1

    how would i change the picture after a certain amount of clicks?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      It's pretty straightforward - do something LIKE the following:
      if num_of_clicks == 10:
      cookie.shape("image.png")

  • @EpicGM100
    @EpicGM100 6 місяців тому +1

    I saw your video and I tried doing it but the picture of the cookie doesn't appear I am doing it on mac and I have it in the same folder as the program but it still doesn't work

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      Can you share your code here? Copy and paste it along with any error messages you're getting.

    • @EpicGM100
      @EpicGM100 6 місяців тому +1

      @@TokyoEdTech I played around with the files and it worked but thanks for replying your python coding tutorials are really awesome and easy to follow love your content btw

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      @@EpicGM100 Glad you got it sorted. Thanks for the kinds words and keep on codin'!

  • @Schlagbohrerzockt
    @Schlagbohrerzockt Рік тому +1

    Has anyone ever told you, that you very much sound like The 8 Bit Guy :D, amazing tutorial though ;)

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Thanks - that is quite the compliment!

  • @R3DD3LUX
    @R3DD3LUX Рік тому

    Hey man , really nice tutorial , thank your for it !

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Thanks! Glad you liked it! Keep on codin'!

  • @muppetbehumble101
    @muppetbehumble101 3 роки тому +1

    Dope video 🔥🔥🔥

  • @itayf.848
    @itayf.848 3 роки тому +1

    40th comment! 🎂🥳

  • @kaihiordie
    @kaihiordie Рік тому +1

    should be obv but check your spelling and capitilazation if you ron windows the screen will tell you what line you messed up

  • @summerkenney4813
    @summerkenney4813 Рік тому +1

    hey why is it that when i get to a certain amount of clicks the "clicks" message moves to the left

    • @shadoww7301
      @shadoww7301 Рік тому +1

      Because the pen is is aligned in the center of its coords (0, 400).
      Its like in MS Word text aligner option that makes text go on the left, middle, or right.
      The middle of the characters in the pen's text aligns to its coords. This means when the text gets longer, (i.e. number of digits going up) the center character of the text changes, and it re-aligns the text back to the center.
      TLDR;
      The "clicks" message isn't moving to the left, both ends of the text are just getting longer when the digit increases.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Thanks for jumping in there!

  • @SkyFly19853
    @SkyFly19853 3 роки тому +2

    Type less...
    Do more...
    Productivity = Python
    ✅✅✅✅✅✅✅✅

  • @dragnify7456
    @dragnify7456 3 роки тому +2

    Yay!

  • @theanimationchannel2736
    @theanimationchannel2736 Рік тому

    Hi, could you please make another tutorial where there is a shop system and clicks per second, just like Cookie Clicker?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому +1

      Hi! I get this request a lot - I'll think about it. I've never really played the real cookie clicker though - will have to check this out.

  • @seabeg
    @seabeg 2 роки тому

    I am getting an error:
    Traceback (most recent call last):
    File "/Users/***/Desktop/CookieClick/Gui", line 11, in
    wn.title("Cookie Click")
    AttributeError: 'function' object has no attribute 'title'

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Can you share the code? Copy and paste is fine.

  • @marlene.thmvan4473
    @marlene.thmvan4473 Рік тому +1

    I don't know why but mine doesn't work, I did it on Trinket with Phyton (not 3) and I get the message that I have an bad input in line 25 :/

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      I'm not sure this will work on Trinket.

    • @PhoenixVids123
      @PhoenixVids123 Рік тому

      @@TokyoEdTech Hey man, when I do this with VS Code, everything works, but... the text doesn't write on the screen at all, I have copied and pasted it from your GitHub and it still doesn't work :( Can you help me fix this? I have a feeling it has something to do with the fact that cookie = turtle.Turtle() and pen use the same thing after, possibly putting the text as cookie. It's that or the pen.hideturtle() line

    • @PhoenixVids123
      @PhoenixVids123 Рік тому

      @@TokyoEdTech never mind, i fixed it, it was going off the screen and the window needed to be expanded for you to see it.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      @@PhoenixVids123 Glad you got it sorted - great job. Keep on codin'!

  • @hannahsmerkonich6856
    @hannahsmerkonich6856 7 місяців тому +2

    you need bacrownd music!😁😁

  • @mongus1807
    @mongus1807 3 роки тому +1

    Tried this, it says syntax error: position argument follows keyword argument

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      You need to share your code and the exact error message.

  • @gamaray6136
    @gamaray6136 3 роки тому +1

    Why do you tend to use turtle rather than pygame?

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому +1

      Good question - I teach middle and high school students. Pygame is definitely more powerful than the turtle module, but it is also much more complicated. For that reason, I tend to use the turtle module instead.

    • @gamaray6136
      @gamaray6136 3 роки тому +3

      @@TokyoEdTech I see, yeah for kids turtle is probably a better module to teach.

  • @insurgencless
    @insurgencless Рік тому +2

    code:
    import turtle
    wn = turtle.Screen()
    wn.title("Cookie Clicker")
    wn.bgcolor("Black")
    wn.register_shape("cookie.gif")
    cookie = turtle.Turtle()
    cookie.shape("cookie.gif")
    cookie.speed(0)
    clicks = 0
    pen = turtle.Turtle()
    pen.hideturtle()
    pen.color("white")
    pen.pendown()
    pen.goto(0, 270)
    pen.clear()
    pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 50, "normal"))
    def clicked(x,y):
    global clicks
    clicks += 1
    pen.clear()
    pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 50, "normal"))
    cookie.onclick(clicked)
    wn.mainloop()

  • @anwarsadat7072
    @anwarsadat7072 2 роки тому +5

    339th comment lets go!
    claim your before 1000 comments
    👇

  • @anhkiet9425
    @anhkiet9425 3 роки тому +1

    thx for make this video , i love it :)

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      You're welcome - keep on codin'!

  • @lockedgaming6081
    @lockedgaming6081 Рік тому +1

    it says something about unicode at where it says wn.register_shape, im also on windows so i put the full path

  • @molotov5000
    @molotov5000 2 роки тому +3

    when i click the cookie the number goes away, whats the solution here? if anyone can tell me thx :D

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      If you share your code here I will take a look.

    • @molotov5000
      @molotov5000 2 роки тому

      @@TokyoEdTech ok so, i followed the tut, did everything right according to me. (not very accurate) so here the code i wrote according to your video:
      import turtle
      wn = turtle.Screen()
      wn.title("cookieclicker thingy by commander molotov")
      wn.bgcolor("Black")
      wn.register_shape("249534.gif")
      cookie = turtle.Turtle()
      cookie.shape("249534.gif")
      cookie.speed(0)
      clicks = 0
      pen = turtle.Turtle()
      pen.hideturtle()
      pen.color("white")
      pen.penup()
      pen.goto(0, 300)
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      def clicked(x, y):
      global clicks
      clicks =+ 1
      pen.clear()
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      cookie.onclick(clicked)
      wn.mainloop()

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      @@molotov5000 In your clicked method you need to indent the pen.write line.

    • @molotov5000
      @molotov5000 2 роки тому +1

      @@TokyoEdTech ohhhh thanks

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      @@molotov5000 Sure thing - keep on codin'!

  • @rabiasonmez2329
    @rabiasonmez2329 Рік тому +1

    Hi, I dont have any error but when i click it does not count

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Hmmm...if you share your code I can take a look.

    • @rabiasonmez2329
      @rabiasonmez2329 Рік тому

      @@TokyoEdTech Thank you for the reply but i already figured it out and its working, thank you so much for the video :)

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      @@rabiasonmez2329 You're quite welcome - glad you got it sorted. Keep on codin'!

  • @sakkalwin4932
    @sakkalwin4932 2 роки тому +1

    it doesnt work when i tried to print the picture it just shows a syntax error and theres no cookie in the screen
    heres the code:
    import turtle
    wn = turtle.Screen()
    wn.title("Cookie Clicker")
    wn.bgcolor("black")
    wn.register_shape("cookie.gif")
    cookie = turtle.Turtle()
    cookie.shape("cookie.gif")
    cookie.speed(0)
    wn.mainloop()
    and this was since 5:41 minutes into your video

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      Heya - what was the syntax error? Can you copy and paste it here?

    • @mzterio3169
      @mzterio3169 2 роки тому

      Make sure it is above wn.mainloop()

  • @Aaron_r_d_2OO8
    @Aaron_r_d_2OO8 Рік тому +1

    can you help me too the cookie is not coming into pycharm

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Sure. You probably need the full path to the image.
      Otherwise, share your code here and any error message.

  • @jameszhu7766
    @jameszhu7766 Рік тому +2

    I can't get the cookie to load in.

    • @jameszhu7766
      @jameszhu7766 Рік тому

      I'm on Windows btw

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      You probably need the full path to the image.
      Something like C:\Users\jameszhu\....\cookie.gif
      If you right click and choose properties you can see the full path, I believe...sorry, not a Windows user.
      ubuntu.com/

    • @jameszhu7766
      @jameszhu7766 Рік тому

      @@TokyoEdTech Ok thx I'll try it!

  • @Mistereee
    @Mistereee 2 роки тому

    when i run it it has the error "self.tk.call(('image', 'create', imgtype, name,) + options)
    _tkinter.TclError: couldn't open "cookie.gif": no such file or directory" even though i have the .py and .gif files in the same folder

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Are you sure it is a gif image? On windows you night need the complete path to the file

    • @Mistereee
      @Mistereee 2 роки тому

      @@TokyoEdTech yeah its a gif, the issue fixed itself when i turned my pc off and on (that trick seems to fix everything)

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      It never fails!

  • @Furrysm
    @Furrysm Рік тому

    What is the program you are using?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      It's called Geany. I made a short video about it here: ua-cam.com/video/quemIgUn4C8/v-deo.html

  • @patkokvasko4665
    @patkokvasko4665 3 роки тому +1

    Hi! This is the first video I've watched from you and I am so glad I found you because this video was so good! It has everything what begginer needs. But I have a little problem...
    When I execute the game I can't see the text Clicks: 0.
    I checked the code and it was written correctly and I have Python version 3.8 so that shouldn't be problem neither sooo... I don't know.
    I would really appriciate your help. :D Thanks.

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Thanks! Try moving the text lower on the screen. It's probably there but off the screen.

  • @harshavardhanakkenapally1045

    All the code lines and everything ids the same but the wind that opes only shows the cookie

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      The text is probably off screen. Try moving the pen down.

  • @joec23
    @joec23 Рік тому

    Hello, this isn't working for me unfortunately - i'm using PyCharm via MacOS and when I run the code (copied exactly from your link with the image in the correct folder etc) the window opens really small with the scroll bars glitching out (no image or custom title either, it says "Python Turtle Graphics" on the top bar). When I then close the window i get a bunch of errors all referencing this file: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py" and this: _tkinter.TclError: can't invoke "bind" command: application has been destroyed. Any ideas?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Can you copy and paste your code here?

    • @joec23
      @joec23 Рік тому

      @@TokyoEdTech
      import turtle
      wn = turtle.Screen()
      wn.title("Cookie Clicker by @TokyoEdtech")
      wn.bgcolor("black")
      wn.register_shape("cookie.gif")
      cookie = turtle.Turtle()
      cookie.shape("cookie.gif")
      cookie.speed(0)
      clicks = 0
      pen = turtle.Turtle()
      pen.hideturtle()
      pen.color("white")
      pen.penup()
      pen.goto(0, 400)
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      def clicked(x, y):
      global clicks
      clicks += 1
      pen.clear()
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      cookie.onclick(clicked)
      wn.mainloop()

    • @joec23
      @joec23 Рік тому

      @@TokyoEdTech It's straight from your github. Not sure what the issue is...thanks in advance for your help :)

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      After wn.bgcolor...try adding this line:
      wn.setup(600, 600)

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      @@joec23 No worries. Some computers are set up differently. It happens.

  • @icakabg0468
    @icakabg0468 Рік тому

    I can't understand which line of code makes it so the counter doesnt go up when you click on anything other than the cookie itself?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      The click is bound to the turtle that has the cookie as it's image so clicking on the cookie is what triggers the clicking event.

    • @icakabg0468
      @icakabg0468 Рік тому

      thanks! @@TokyoEdTech

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      You're welcome. Keep on coding!

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      @@icakabg0468 You're welcome!

  • @jim02754
    @jim02754 3 роки тому +1

    so i made a clicker game without any game library i only used tkiter and i am about to add a small data base to kame it store the score and the upgrades (i don't know wy i comented )

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Glad to hear that - thanks for sharing! Keep on codin'!

  • @Ogabrielzin117
    @Ogabrielzin117 Рік тому +1

    Cool bro!!! Tks for this

  • @ngpclan3298
    @ngpclan3298 Рік тому +2

    everything works but the text wont show up

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Can you share your code here and I'll take a look.

    • @TheCubingChronicles
      @TheCubingChronicles Рік тому +2

      Same happens to me. Try changing the coordinates to (0, 200)

    • @TokyoEdTech
      @TokyoEdTech  Рік тому +1

      @@TheCubingChronicles Thanks for jumping in there!

    • @treborydt
      @treborydt Рік тому

      probably up there, make the turtle screen bigger. Happend to me

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      @@treborydt Thanks - I should have addressed that in the video, but didn't.
      wn.setup(600, 600)
      600x600 is the default for a lot of systems, but apparently not all.

  • @mr.elemental588
    @mr.elemental588 3 роки тому

    It dont show me the clicks...
    Is it because of version of python?
    Mine is 3.9.0

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      There is a link in the description labeled “NEED HELP?” Check that out and get back to me. Keep on codin’!

  • @chwizzer4329
    @chwizzer4329 3 роки тому

    this is actually kinda works but the problem is that i use idle python 3.5.1 and when i do the f"Clicks: {clicks}" it showes me an error and if i delete the f neither way the text won't appear

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      You should update to the latest Python version so you can use f strings - very convenient!

    • @urosradosavljevic3047
      @urosradosavljevic3047 3 роки тому

      The text wont appear did you find the solution?

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      @@urosradosavljevic3047 There is a link in the description labeled “NEED HELP?” Check that out and get back to me. Keep on codin’!

  • @stalledfb
    @stalledfb Рік тому

    it workes but when i click the image the clickes dont go up do you have a fix?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      I need to see the code. Can you paste it here?

    • @stalledfb
      @stalledfb Рік тому

      @@TokyoEdTech heres the code. import turtle
      wn = turtle.Screen()
      wn.title("Cookie Clicker by meeee")
      wn.bgcolor("blue")
      wn.register_shape("cookie.gif")
      cookie = turtle.Turtle()
      cookie.shape("cookie.gif")
      cookie.speed(0)
      clicks = 0
      pen = turtle.Turtle()
      pen.hideturtle()
      pen.color("white")
      pen.penup()
      pen.goto(0, 400)
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      def clicked():
      global clicks
      clicks +=1
      pen.clear()
      pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))
      cookie.onclick(clicked)
      wn.mainloop()

  • @BBlaZeCodeZ
    @BBlaZeCodeZ 7 місяців тому +1

    Does anyone know why when i run the script the window that i opened gets closed after half a second?

    • @TokyoEdTech
      @TokyoEdTech  7 місяців тому

      You have an error in your code. Check your error messages.

    • @GabTheGamerGT
      @GabTheGamerGT 6 місяців тому

      do you have the wn.mainloop()

  • @baldavsingh4596
    @baldavsingh4596 6 місяців тому

    How can i add this upgrade that when the clicks count reaches the factor of 100 the cookie picture changes

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      You need to add something like:
      wn.register_shape("cookie2.gif")
      And
      if clicks>100:
      cookie.shape("cookie2.gif")

    • @baldavsingh4596
      @baldavsingh4596 6 місяців тому

      How can I add :-
      Another game mode that number of clicks are divided by given amount of time , so we clicks per second ?

    • @TokyoEdTech
      @TokyoEdTech  6 місяців тому

      @@baldavsingh4596 That's not as simple - you need to get the start time then calculate the clicks per second as you play. It's not super complicated, but requires a bit more knowledge then I would expect a beginner to have.

  • @GabTheGamerGT
    @GabTheGamerGT Рік тому

    do you have a tutorial for mac aswell?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      It should work on all platforms. The only the ng that really differs is making sounds

  • @RATANAGARWALITINFORMER
    @RATANAGARWALITINFORMER 3 роки тому +1

    GOOD INFO

  • @animationsbelike
    @animationsbelike 2 роки тому +1

    NIce vide i really like it thanks :)

  • @dragoener__0219
    @dragoener__0219 2 роки тому

    hey i am a German guy and i like your tutorial and i am new to python can you help me to learn how to get a upgrade shop and a automatic generate cookie ? i dont know how to code that

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      I could probably figure that out, but it would be better for you to try to figure it out on your own...you'll learn better that way.

    • @dragoener__0219
      @dragoener__0219 2 роки тому +1

      @@TokyoEdTech Jeah Sure But where can i learn it i have no idea where i can watch. Or what i Need and ty for the fast answer

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      It's not a simple thing that can be explained ina comment. Keep learning and one day you'll be able to do it in your own!

  • @kutup1763
    @kutup1763 2 роки тому +1

    Hey can u make a upgrading system in code?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Hiya - I get this request from time to time - I might try it someday. I'm not really familiar with the game though to know what kind of upgrades can be done.

    • @kutup1763
      @kutup1763 2 роки тому

      @@TokyoEdTech like click upgrade or auto click

  • @Mdroudian
    @Mdroudian 2 роки тому +2

    Gimp... The free Photoshop

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Yep - I've been using it for years!

  • @გიორგიშალამბერიძე-წ3ჯ

    I tried to make it with a different .gif and everything works eccept it doesnt show how many times i clicked, not even the text. I even copy & pasted to make sure it wanst my fault but it didnt show the text still. Im on Windows 10. Is it an OS problem?

    • @TokyoEdTech
      @TokyoEdTech  8 місяців тому

      You may have 2 problems:
      1. On Windows you probably need the full path to the image, something like C:\Users\...\cookie.gif
      2. You might have to move the text down the screen it might be outside the visible window.

    • @GabTheGamerGT
      @GabTheGamerGT 6 місяців тому +1

      @@TokyoEdTech thanks this also worked for me!

  • @jeremyhubaker1199
    @jeremyhubaker1199 Рік тому

    Why not just use pillow module instead of turtle?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      The pillow module is completely different and doesn't do what the turtle module does.

  • @GlitchedGD
    @GlitchedGD 2 роки тому +1

    On line 12 wn.register_shape(“cookie.gif”) I’m getting an error that it can’t open the file. I’m on Mac and I have the file in the project folder what should I do?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      Are you sure the file is a gif? Or did you just rename it? It must be a gif.

    • @bat9614
      @bat9614 2 роки тому +2

      Just had the same problem as you, if you're on Windows (like I am) then instead of the file name write r'C:\Users\(your user name)\Desktop\cookie.gif' or you can copy the file location, add the file name at the end and an 'r' before the file location as shown in my example. I hope it works. Good luck with your game.

    • @bat9614
      @bat9614 2 роки тому

      PS. You'll have to add that long string when declaring the shape too

    • @GlitchedGD
      @GlitchedGD 2 роки тому

      I changed the file to a gif it must be something small wrong with my code I’ll check it

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      @@GlitchedGD How did you change it to a gif? What program did you use? Try a different file - some images don't work for some reason.

  • @thesticknodesguy
    @thesticknodesguy 3 роки тому +1

    180th comment don't let the ball stop keep it a rollin

  • @healingcenter5401
    @healingcenter5401 3 роки тому

    Does it work with Visual studio code because I am getting a lot of error

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Yes - it should. What is the exact error message?

  • @dogycak3925
    @dogycak3925 3 роки тому

    The clicks text not showing pls help, thanks

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      There is a link in the description labeled “NEED HELP?” Check that out and get back to me. Keep on codin’!

  • @litosantiago7351
    @litosantiago7351 2 роки тому

    nvm i just installed geany and it worked. I also installed python version 3.10.

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Good to hear - keep on codin'!

  • @therealrxyang
    @therealrxyang 5 місяців тому +1

    HELP I did everything good but does anyone know to make the counter actually go up when I click the cookie. I manually drew the cookie out by myself, so I can't do the same thing he did. But still, does anyone know how to make the counter go up when i click the cookie?

    • @TokyoEdTech
      @TokyoEdTech  5 місяців тому

      Share your code.

    • @therealrxyang
      @therealrxyang 5 місяців тому +1

      @@TokyoEdTech here:
      from turtle import *
      sc = Screen()
      sc.bgcolor('black')
      hideturtle()
      speed(0)
      up()
      goto(0,-100)
      down()
      fillcolor('darkgoldenrod')
      begin_fill()
      c = circle(100)
      cookie = Turtle()
      cookie.shape(c)
      end_fill()
      fillcolor('saddlebrown')
      begin_fill()
      up()
      goto(-35, 35)
      down()
      circle(20)
      end_fill()
      begin_fill()
      up()
      goto(-30, -75)
      down()
      circle(20)
      end_fill()
      begin_fill()
      up()
      goto(59, 10)
      down()
      circle(22)
      end_fill()
      begin_fill()
      up()
      goto(50, -50)
      down()
      circle(17)
      end_fill()
      begin_fill()
      up()
      goto(0, -10)
      down()
      circle(18)
      end_fill()
      begin_fill()
      up()
      goto(-65, -18)
      down()
      circle(13)
      end_fill()
      clicks = 0
      up()
      goto(0, 150)
      pencolor('white')
      write('Clicks: '+str(clicks), align='center', font = ('Arial', 20, 'normal'))
      def clicked(x,y):
      global clicks
      clicks += 1
      clear()
      write('Clicks: '+str(clicks), align='center', font = ('Arial', 20, 'normal'))
      cookie.onclick(clicked)
      done()
      I know where I got it wrong but I don't know how to fix it

    • @MCF-318
      @MCF-318 Місяць тому +1

      @@therealrxyang sorry i didn't find this earlier but here is your corrected code:
      from turtle import *
      # Setup the screen
      sc = Screen()
      sc.bgcolor('black')
      speed(0)
      # Draw the cookie
      def draw_cookie():
      # Draw the cookie body
      up()
      goto(0, -100) # Move to the center-bottom
      down()
      fillcolor('darkgoldenrod')
      begin_fill()
      circle(100) # Draw the cookie
      end_fill()
      # Draw the chocolate chips
      fillcolor('saddlebrown')
      begin_fill()
      up()
      goto(-35, 35)
      down()
      circle(20) # Draw first chocolate chip
      end_fill()
      begin_fill()
      up()
      goto(-30, -75)
      down()
      circle(20) # Draw second chocolate chip
      end_fill()
      begin_fill()
      up()
      goto(59, 10)
      down()
      circle(22) # Draw third chocolate chip
      end_fill()
      begin_fill()
      up()
      goto(50, -50)
      down()
      circle(17) # Draw fourth chocolate chip
      end_fill()
      begin_fill()
      up()
      goto(0, -10)
      down()
      circle(18) # Draw fifth chocolate chip
      end_fill()
      begin_fill()
      up()
      goto(-65, -18)
      down()
      circle(13) # Draw sixth chocolate chip
      end_fill()
      # Initialize clicks
      clicks = 0
      # Draw initial state
      draw_cookie()
      # Display click count
      up()
      goto(0, 150)
      pencolor('white')
      write('Clicks: ' + str(clicks), align='center', font=('Arial', 20, 'normal'))
      # Click handler function
      def clicked(x, y):
      global clicks
      clicks += 1
      clear() # Clear the drawing
      draw_cookie() # Redraw the cookie
      up()
      goto(0, 150) # Move to the click count position
      write('Clicks: ' + str(clicks), align='center', font=('Arial', 20, 'normal'))
      # Set up the cookie turtle to register clicks
      cookie = Turtle()
      cookie.hideturtle() # Hide the turtle
      cookie.speed(0) # Fastest drawing speed
      cookie.shape("circle") # Set the shape to a circle
      cookie.shapesize(stretch_wid=10, stretch_len=10) # Make the turtle larger
      cookie.color('darkgoldenrod') # Set the turtle color to match the cookie
      cookie.onclick(clicked) # Register the click event
      done()
      i added hashtags to make it easier for you my improvements were: Function for Drawing the Cookie: I encapsulated the drawing logic inside the draw_cookie() function to keep the code organized and reusable.
      Clickable Cookie: Created a separate Turtle instance named cookie for handling click events. This turtle is set to a larger size and is positioned at the center to simulate clicking on the cookie.
      Redraw on Click: The clicked() function now clears the screen, redraws the cookie, and updates the click count each time it is clicked.
      Initialization: The initial cookie is drawn once before any clicks, so it appears immediately on the screen.

  • @siriuslemaitre4833
    @siriuslemaitre4833 3 роки тому +1

    "couldn't open "cookie.gif": no such file or directory" that happened when I launched the script, even if my file is on my desktop. here is my script, but i dont think the problem is here :
    import turtle
    wn = turtle.Screen()
    wn.title("Cookie Clicker")
    wn.bgcolor("black")
    wn.register_shape("cookie.gif")
    cookie = turtle.Turtle()
    cookie.shape("cookie.gif")
    cookie.speed(0)
    wn.mainloop()
    thanks for helping me in advance.

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому +1

      You've probably got one of 3 likely problems:
      1) The file is in one place, but the python program file is not
      2) Especially on Windows, you need the full path. Something like C:\Users\....\filename.gif
      3) The file is not a gif. Renaming a file from .png to .gif doesn't make it a gif - you need to use a program to convert it.

  • @rizwanzafar413
    @rizwanzafar413 Рік тому +1

    can u pls update this game cause its pretty fun and pls add more stuff to buy

    • @TokyoEdTech
      @TokyoEdTech  10 місяців тому

      If you want to learn to code, you gotta code - see if you can figure it out!

  • @GiraffeLegend1234
    @GiraffeLegend1234 Рік тому

    The image and the code is in the same file, but for some reason it doesn't work. the image is a gif file, and followed your steps, but it seems to not work.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      If you are on Windows you may need the full path to your file. C:\Users....

    • @dylanhaynes728
      @dylanhaynes728 Рік тому

      I had the same issue and it was because the wn.mainloop () was above that section of code and it must be at the bottom. Hope that helps

  • @dezul198
    @dezul198 2 роки тому +1

    the text is not showing me , what to do now? please help

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Try watching closely. Also, try making the window bigger.
      If that doesn't help, paste your code here and any error messages.

    • @user-ib1tk8vg8t
      @user-ib1tk8vg8t 2 роки тому

      @@TokyoEdTech pen.write(f"Clicks: {clicks}", align="center", font=("Courier New", 32, "normal"))

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      @@user-ib1tk8vg8t If you need help, please share all the code and describe the problem in detail.

    • @user-ib1tk8vg8t
      @user-ib1tk8vg8t 2 роки тому +1

      scratch that i figured it out

    • @lauralarbi-tieku9900
      @lauralarbi-tieku9900 2 роки тому

      @@user-ib1tk8vg8t how did you? I'm facing the same issue

  • @ThatOneGuy-dc2xe
    @ThatOneGuy-dc2xe Рік тому

    I don't know how, but my text overlaps every time I click the cookie

  • @Thomate1375
    @Thomate1375 2 роки тому

    Heey, nice video... But actually you missed the biggest part with all the upgrades that you can buy and will generate cookies for you automatically 😅😂

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      Thanks. Yeah - I only ever played the really simple version. I wanted this to be an easy tutorial for my students.

    • @Thomate1375
      @Thomate1375 2 роки тому

      @@TokyoEdTech still a good video, maybe that could be something for a part two:D

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому +1

      @@Thomate1375 Possibly! But, it would be a good idea for you to do this on your own to develop your skills.

    • @Thomate1375
      @Thomate1375 2 роки тому +1

      @@TokyoEdTech actually thats exactly what I'm doing right now 😂😅

    • @Thomate1375
      @Thomate1375 2 роки тому

      But tbh im kind of struggling with python... I'm pretty good at c and c#, but I have just started to learn python 😂😅

  • @kitkat6747
    @kitkat6747 2 роки тому

    can you please make a part 2 covering animations