Make 2048 In Python | Full Python Game Tutorial

Поделиться
HTML-код
  • Опубликовано: 29 дек 2024

Комментарии • 51

  • @TechWithTim
    @TechWithTim  8 месяцев назад +4

    To learn programming and Python - Check out Datacamp!
    Learn Python: datacamp.pxf.io/ba4zym
    Learn Programming: datacamp.pxf.io/3e6xOy

  • @aidannt
    @aidannt 8 месяцев назад +35

    you're the only person who still walks us through how to use pip 😅
    keep it up!

  • @ദാസപ്പൻ1
    @ദാസപ്പൻ1 8 месяцев назад +2

    You are the only one person who teached me Socket programming correctly in 2021. 3 years passed

  • @chandrasekars8904
    @chandrasekars8904 8 месяцев назад +1

    This is really an excellent channel on Python like "techie talkee"

  • @wonnor42
    @wonnor42 8 месяцев назад +1

    You make great and inspiring videos, Tim. I love them a lot for new inspiration. However, I stopped at this one 39:04 and thought a bit. I probably missed the purpose of this game - dont know it. But the code is defenetely something I don't want to see in a huge project: The function get_random_pos. 1) Minor... the first two lines are of absolutely of no use (in python) 2) using a key which seems strange (unless I read all the code) into an iterable that I dont know about. 3) Worst. This function could run forever

  • @reymarckesaguirre4102
    @reymarckesaguirre4102 8 месяцев назад +8

    I was thinking these days about how would I make grids in my python games. Then this tutorial came out.
    I am sold that Tim is a fcking mind reader.

  • @TanmayBhatgare
    @TanmayBhatgare 8 месяцев назад +22

    Wtf bro you made better frontend in python than me in HTML😢

    • @jacobmars1902
      @jacobmars1902 8 месяцев назад +8

      reality is often disappointing

    • @IlTjaylI
      @IlTjaylI 8 месяцев назад +2

      Reality is realising that you will forever be disappointed in yourself if you compare yourself to others. Many people don't get that that statement really means. It means the someone will always be better than you at something because they have more experience and sometimes an experience you will never truly match unless you put your heart to it.

    • @Mecagothits
      @Mecagothits 8 месяцев назад

      Hahah yeah trio

  • @esrx7a
    @esrx7a 8 месяцев назад

    Awesome Tim!

  • @petegranneman1623
    @petegranneman1623 7 месяцев назад

    Great content, clear explanation! Keep it up!

  • @toolzshed
    @toolzshed 8 месяцев назад +1

    Whoa sweet 🤘🏽🔥

  • @justhamza_3344
    @justhamza_3344 8 месяцев назад

    bro perfect tutorial keep it up | now im going to edit it by changing the colors a bit

  • @barebonestactical
    @barebonestactical 8 месяцев назад +1

    Love watching your videos I do have a question about the logic for determining tile colors though at 24:50.
    Obviously there’s no “right” answer but wondering why not just have the colors be a dict with the possible tile values as the keys and you could simply just get the color tuple from using the tile value as an index.
    Just curious for any specific reasoning or just simply the reason of just done in another way 🙂

  • @Overlycomplicatedswede
    @Overlycomplicatedswede 8 месяцев назад

    tim always dropping very easy to follow guides and i was wondering if someone had coded this i tried to on my own then found this video on got my version working after some tweeks!

  • @peyman_shabani
    @peyman_shabani 7 месяцев назад

    Great content and so clear explanation thanks Tim😊❤

  • @DrCognitive
    @DrCognitive 8 месяцев назад +1

    I'd rather see an enhanced/updated version of your high school game of mini-golf or whatever that game was. LOL That looked like simple fun.

  • @KindaMC
    @KindaMC 8 месяцев назад +1

    Hey Tim! I was wondering if sometime you could make a video on how to make a web application with sign-ins (maybe using Choreo or something) to which I can just add pygame applications and play them so I can share them with friends?

  • @abdulwajid923
    @abdulwajid923 8 месяцев назад

    Great video i learn a lot how to use pip and about selecting interpreter thank you

  • @timermens350
    @timermens350 8 месяцев назад +1

    Very nice! Been playing it a bit on a 8x8 grid. I noticed some unwanted behaviour in certain conditions though. Sometimes three 4's f.e. merge in one 8... I think when all 4's are. moving. Haven't figured it out yet. Thought you should know.
    Tnx for your channel. It really helps me a lot as a hobbiist "programmer". I try to motivate the son (12yo) of my girlfriend to use his laptop not only for Fortnite, and he likes your teaching style as well. Keep it up!

  • @GeneKim-g1w
    @GeneKim-g1w 8 месяцев назад +1

    Hey Tim, I was wondering if it is possible to make a scoring system in the game. I've coded the entire program and just wanna add some final touch ups!

  • @Marzex1x
    @Marzex1x 8 месяцев назад

    Hey bro I just wanted to say props to u for how good u did in that interview 4 years ago with Clement Mihailesco, I just watched the whole video again and tried to solve the same problem as you but in c++ it's a cool way to kind of get a feel for what you could expect in a real interview and I hope to get one soon enough. Btw any advice on how to land an internship at some of the sligtly bigger companies and also i'm not from the US so an in person internship isn't a possibility. Appreciate you 💜

  • @reymarckesaguirre4102
    @reymarckesaguirre4102 8 месяцев назад +1

    So I decided to rest from this video for now, because I am getting too much info overload on the movement functionality. But I'll get back to it soon.
    HOWEVER, if there are anyone here, Android devs, wondering how to do this but with touch screen controls instead of keyboard, I made something that is admittedly not perfect, but a simple way to detect swiping. Here is how I detect if the user swiped up or down (go code the right and left, as well as a way to tell if the user meant to go on the y or x axis.):
    def main(window):
    clock = pygame.time.Clock()
    run = True
    tiles = generate_tiles()
    track_finger_x = []
    track_finger_y = []
    while run:
    clock.tick(FPS)
    for event in pygame.event.get():
    if event.type == pygame.QUIT:
    run = False
    break
    elif event.type == pygame.FINGERMOTION:
    print("Triggered Down")
    track_finger_x.append(event.x)
    track_finger_y.append(event.y)
    elif event.type == pygame.FINGERUP:
    print("Triggered Up")
    if len(track_finger_y) == 0:
    continue
    elif len(track_finger_y) > 0:
    if track_finger_y[0] > track_finger_y[len(track_finger_y) - 1]:
    print("Moved up")
    elif track_finger_y[0] < track_finger_y[len(track_finger_y) - 1]:
    print("Moved down")
    track_finger_y.clear()

    • @reymarckesaguirre4102
      @reymarckesaguirre4102 8 месяцев назад +1

      I also forgot to remove the print, but I used those for debug during the coding process.
      I couldn't find a lot of tutorials online about Pygame swipe, and the FINGERMOTION.dy object is only measuring too short distances to be of any use.

  • @Koko-So-Meitantei_
    @Koko-So-Meitantei_ 6 месяцев назад

    34:29 I get absoluteerror: ‘Tile’ object has no attribute ‘draw’

  • @usamashami11
    @usamashami11 8 месяцев назад +2

    Best Python Game Developer in Town 🥹
    Never in my life I thought you would be able to code one of my fav. game in Python ❤

  • @Adam9174X
    @Adam9174X 8 месяцев назад +2

    Can you make a Tutorial about OpenGL in Python ?

  • @Clipaholick
    @Clipaholick 8 месяцев назад

    amazing!

  • @arnavshukla4271
    @arnavshukla4271 8 месяцев назад

    Hi Tim! Can you please make more videos on web development?

  • @og_rexsteve
    @og_rexsteve 8 месяцев назад

    Just to think I am currently hooked on this game at the moment :)

  • @viktor2160
    @viktor2160 8 месяцев назад

    Hello Tim. I am having 3-4 years of experience with python, what do you recommend to do in order to improve my skills? Thank you.

  • @NikhilVerma-jk9ng
    @NikhilVerma-jk9ng 8 месяцев назад

    You are the best

  • @SouLDYNAMOX9
    @SouLDYNAMOX9 8 месяцев назад

    What theme do you use. I love your theme

  • @HenryTSBs
    @HenryTSBs 5 месяцев назад

    Can you tell me what version of VS Code are you using Tim! Thanks!

  • @samoylov1973
    @samoylov1973 8 месяцев назад

    It would be nice, if the game gave users some kind of final score.
    score = sum([tile.value for tile in tiles.values()])
    print(f"Your score - {score}")
    And not only in konsole, but in actual game board.
    Thanks for the tutorial. Learning.

  • @KindaMC
    @KindaMC 8 месяцев назад +1

    I noticed at 5:43, you put "RGV" instead of "RGB," I assume that's a typo? Also, later it says PI GAME instead of PYGAME.

  • @GRSG_tech
    @GRSG_tech 8 месяцев назад

    Tim, Love you content and I appreciate it
    Can you please make a video on python PANDAS module

  • @gianespineda
    @gianespineda 8 месяцев назад

    Can you make a tutorial in htmx and flask

  • @thebugbyte
    @thebugbyte 3 месяца назад

    I am following the tutorial and its really good everything is worker except for my boundary_check in the if statement is saying that boundary_check is not a thing even though i have boundary_check = lambda tile: tile.col == 0. Please help

  • @yousuf_mamin5767
    @yousuf_mamin5767 8 месяцев назад

    added game over text , escape key to restart option, now trying to display win message when 2048 is reached.

  • @zixinzhang6157
    @zixinzhang6157 6 месяцев назад +1

    There is an error to fix, because when there are four 4 in a line, they merge into a 8 and a 4...

  • @nirmal-b3i
    @nirmal-b3i 3 месяца назад

    bro I copy pasted your code on vscode and it is showing syntax error i did install pygame before but still

    • @Dr.Hollstein
      @Dr.Hollstein 21 день назад

      In the bottom right corner, there should be a version of python. Click on that and choose another version until it works

  • @BobChess
    @BobChess 8 месяцев назад +1

    This game is from 2048. Far from future

  • @-PIETROO-
    @-PIETROO- 8 месяцев назад

    19:14

  • @justhamza_3344
    @justhamza_3344 8 месяцев назад

    also a 4 merged into a 16 but never mind🤪

  • @riyaops4090
    @riyaops4090 8 месяцев назад

    game over kaha hai isme game over likha bhi to ana chaiye game chlta hi jara h

  • @AbleslayerCollectives
    @AbleslayerCollectives 6 месяцев назад

    pygame has no attribute init very bad tutorial no one should watch this