Make 2048 In Python | Full Python Game Tutorial

preview_player
Показать описание
To learn programming and Python - Check out Datacamp!

In this Python tutorial, I will be showing you how to build the game "2048". This childhood-favorite of mine is a bit complex so I will be showing you some advanced techniques to structure a game like this. By the end of this video, you will have a fully-functional game to add to your portfolio in addition to a handful of new techniques to add to your toolbelt.

🎓 Premium Courses 🎓

🎓 Free Courses 🎓

🎞 Video Resources 🎞

⏳ Timestamps ⏳
00:00 | Project Demo
00:50 | Project Overview/Plan
02:18 | Setup/Dependencies
03:45 | Constants Definition
08:27 | Game Loop
11:54 | Drawing
19:42 | Defining The Tiles
39:54 | Moving The Tiles - Explanation
46:07 | Moving The Tiles - Implementation

🔖 Tags 🔖
- Python Game Development
- Building Games in Python
- How To Code A Game

Hashtags
#pythonprogramming
#techwithtim
#pythongame
Рекомендации по теме
Комментарии
Автор

To learn programming and Python - Check out Datacamp!

TechWithTim
Автор

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

keep it up!

aidannt
Автор

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

ദാസപ്പൻ
Автор

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

wonnor
Автор

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

chandrasekars
Автор

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.

reymarckesaguirre
Автор

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!

Overlycomplicatedswede
Автор

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

TanmayBhatgare
Автор

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

justhamza_
Автор

Great content, clear explanation! Keep it up!

petegranneman
Автор

Great content and so clear explanation thanks Tim😊❤

peyman_shabani
Автор

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 ❤

usamashami
Автор

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")



elif event.type == pygame.FINGERUP:
print("Triggered Up")
if len(track_finger_y) == 0:

elif len(track_finger_y) > 0:
track_finger_y[0] > - 1]:
up")
track_finger_y[0] < - 1]:
down")
track_finger_y.clear()

reymarckesaguirre
Автор

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!

timermens
Автор

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

abdulwajid
Автор

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 🙂

barebonestactical
Автор

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.

DrCognitive
Автор

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 💜

Marzexx
Автор

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?

KindaMC
Автор

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!

GeneKim-gw
visit shbcf.ru