Master Python by making 5 games

Thanks to Brilliant for the support, you can find them here: brilliant.org/ClearCode/
This video covers game development in Python. We will create a spaceship shooter, a Vampire survivor style game, Pong, a platformer and a Pokémon inspired battle game. Via those you can master your knowledge of Python since we will touch on every part of the language and use inheritance, decorators, dunder statements and a lot more.
Related videos:
Masks - • Understanding Pygame m...
Tiled - • A guide to level creat...
Ultimate intro to Godot 4 - • The ultimate introduct...
Complete guide to Python - • The complete guide to ...
Find/support me on other channels
Patreon - / clearcode
Twitter - / clear_coder
Discord - / discord
Shoutout to Scarloxy for creating the Pokemon and Vampire survivor graphics: / scarloxy
Project files:
start files - github.com/clear-code-project...
stages - drive.google.com/drive/folder...
Timestamps:
00:00:00 - Intro and pygame overview
00:06:49 - Spaceship game
00:19:20 - Drawing surfaces
00:42:11 - Rectangles
01:03:52 - Movement & delta time
01:29:35 - getting input
01:54:25 - sprites
02:13:53 - working with time
02:36:01 - collisions
02:53:02 - drawing other things
03:12:35 - finishing the space game (transform, masks & sound)
03:45:23 - Vampire survivor
04:00:24 - proper collisions
04:20:23 - creating levels in Tiled
04:42:08 - Creating a camera
05:04:43 - Player animations
05:19:23 - Shooting!
05:45:37 - Enemies
06:03:18 - finishing the game
06:15:29 - Pong
06:41:48 - Collisions between moving objects
06:55:35 - using inheritance
07:04:01 - loading and saving data
07:25:35 - Platformer game
07:40:28 - Platformer logic
07:54:25 - Platformer animations
08:19:37 - Creating timers
08:46:09 - Bees and worms
09:09:20 - Monster Battle
09:28:31 - Creating menus
09:53:05 - Creating more menus
10:12:37 - the battle system
10:28:58 - Adding battle visuals
10:55:37 - finishing the game

Пікірлер: 143

  • @kevcopo
    @kevcopo11 күн бұрын

    First off, I love you. Second, I literally just got gone binging your jumping snail game and followed along the whole way. I was debating the next game to try and you just go and drop this?!?! Thank you sooo much! You're very good at teaching and letting us practice on our own to help us learn, keep up the quality man!

  • @BentoSushi1
    @BentoSushi114 күн бұрын

    Dude stop releasing tutorials at such high quality and so fast I cant keep up!😅😅😂😂

  • @CassyCodes
    @CassyCodes15 күн бұрын

    Amazing. I love these in depth tutorials. Bookmarking this for later!

  • @rrahll
    @rrahll15 күн бұрын

    I just started, thank you so much for this huge course!

  • @Geographyball1
    @Geographyball115 күн бұрын

    Instructions unclear, accidentally made minecraft 2.0

  • @Doubleshotgun

    @Doubleshotgun

    15 күн бұрын

    Wow, you must be a fast learner

  • @CodeKokeshi

    @CodeKokeshi

    11 күн бұрын

    I made a catch the bullet in head disease and how far can you get from jumping on a building game.

  • @seccuenta50ydos
    @seccuenta50ydos15 күн бұрын

    I love how clear all of your explanations always are!

  • @101touchapps
    @101touchapps15 күн бұрын

    damn Christian. wooooo. awesome! i took your python game dev course on udemy. finished it 100%. 😅 i had to take 1 week off to rest. its good to see this. will definately take my sweet time and work on this too.

  • @emperor8716
    @emperor871615 күн бұрын

    you are a legend man. i followed your ultimate pygame tutorial, and you and dafluffypotato inspired me to make a game engine using pygame. (though i moved on to making it in c++ 😂)

  • @chigstardan7285

    @chigstardan7285

    15 күн бұрын

    Christian and DaFluffyPotato are pygame legends!

  • @Choco794

    @Choco794

    14 күн бұрын

    @@chigstardan7285 They should team up to make something, it would cool.

  • @Choco794

    @Choco794

    14 күн бұрын

    @@chigstardan7285 They should team up for something. That would be cool

  • @ethan6933
    @ethan693312 күн бұрын

    this is crazy, im loving these tutorials im learning loads, clear code might be the goat

  • @akhilallamraju9079
    @akhilallamraju90793 күн бұрын

    I am amazed that a tutorial like this is available for free. Hats off to you, sir and thank you so much

  • @rrahll
    @rrahll15 күн бұрын

    Thank you Clear Code! This is awesome!

  • @user-xp6go1gi9m
    @user-xp6go1gi9m11 күн бұрын

    wow you realy leveled up your explanation, the vizuals at the start are great!

  • @salzig1
    @salzig114 күн бұрын

    Wow, this is probably the best and most comprehensive tutorial on how make games with pygame on yt. Thanks

  • @yangzhuoxunnhps
    @yangzhuoxunnhps14 күн бұрын

    Amazing! Keep up the good work!

  • @AntonioPereiradaSilvaSantos
    @AntonioPereiradaSilvaSantos14 күн бұрын

    Thanks for this and every other video. I'll watch everything.

  • @amirsaid
    @amirsaid15 күн бұрын

    thank u very much i learned python from u,keep up the good work sir

  • @AxXis--
    @AxXis--15 күн бұрын

    This is exacly what I needed!

  • @zweinhanderhiruzen9811
    @zweinhanderhiruzen981115 күн бұрын

    This is just amazing for real. I cannot believe this is for free. You sir, are a legend.

  • @DiffamaNature
    @DiffamaNature14 күн бұрын

    Sir you really got that way to teach everything easily to beginners. Now I'm broke like a hell but be sure I'll support you once I get a job as a developer

  • @axwellcorp
    @axwellcorp15 күн бұрын

    Amazing tutorial, thank you!

  • @johnexists
    @johnexists15 күн бұрын

    you are a godsend bro, keep it up

  • @erfanlab3728
    @erfanlab372811 күн бұрын

    man you are a legend thank you for all the effort

  • @alhamzahalalawnah6312
    @alhamzahalalawnah63126 күн бұрын

    Great work. Hope you make similar tutorials about web games

  • @dinocat8
    @dinocat815 күн бұрын

    Can't believe these resources are free ! You are amazing

  • @that_cutekitten03
    @that_cutekitten0314 күн бұрын

    you should have much more subs for it being so good 🔥

  • @chevere3424
    @chevere34249 күн бұрын

    You have a gift for teaching!

  • @bulkierpanda133
    @bulkierpanda1334 күн бұрын

    Wow only been 30 minutes into the video I'm already thinking about creating art and also making it move this is awesome

  • @brandonjacksoon
    @brandonjacksoon15 күн бұрын

    Awesome course!

  • @brettinabox5607
    @brettinabox560714 күн бұрын

    Between this and your discord, i owe all the vast majority of my programming knowledge to you, thank you so much for your help.

  • @mattiamauro4255
    @mattiamauro42559 күн бұрын

    One of the best coding guides ever. I am 14 and Italian, so not even english, and I understood EVERYTHING

  • @jamil5522
    @jamil552211 күн бұрын

    You're so underrated my guy ❤

  • @user-yh3dc4sl7j
    @user-yh3dc4sl7j2 күн бұрын

    Best pygame tutorial by an expert❤

  • @GaBoyInKy
    @GaBoyInKy14 күн бұрын

    Thank you once again, teacher.

  • @ahmadabdulrazaq5440
    @ahmadabdulrazaq544022 сағат бұрын

    Hi, this is probably the BEST tutorial i think i will ever see in my life, from the slow explanation, to the exersices, everything is just pure perfection. I just have a question though, im curerently on the vampire survivor game, is the world.tmx file in the github different from the one in the video?

  • @ClearCode

    @ClearCode

    22 сағат бұрын

    hey, thank you :) It should be the same, does it look different?

  • @ahmadabdulrazaq5440

    @ahmadabdulrazaq5440

    22 сағат бұрын

    Thanks for replying, it does look different, though it does look like a normal map, but different than yours

  • @ahmadabdulrazaq5440

    @ahmadabdulrazaq5440

    22 сағат бұрын

    Im pretty sure they are the same but the video has more objects (ex. more trees in the upper-left corner)

  • @ClearCode

    @ClearCode

    22 сағат бұрын

    @@ahmadabdulrazaq5440 oh damn, sorry about that, if you look at the google drive folder you can find the finished code for each project and the tmx file from the video should be in there; will update the GitHub file tomorrow!

  • @ahmadabdulrazaq5440

    @ahmadabdulrazaq5440

    21 сағат бұрын

    No problem in fact i just realized that it doesnt really effect the game that much since its outside of the game border, one more question and im so sorry for bothering you but when we get the collision sprites in: CollisionSprite((obj.x, obj.y), pygame.Surface((obj.width, obj.height)), self.collision sprites) The surface we created is showing up black instead of transparent, how do i fix that?

  • @user-po2oo4bg6s
    @user-po2oo4bg6s15 күн бұрын

    You are the best!!!! Thanks!!!!

  • @fury4834
    @fury48342 сағат бұрын

    Any plans on a series (possibly incorporating godot), books, or collaboration one day?

  • @UnderArea51
    @UnderArea5114 күн бұрын

    OMG! I love this!!! 🎉

  • @rrahll
    @rrahll15 күн бұрын

    You are the Legend!

  • @sonu-jangir
    @sonu-jangir15 күн бұрын

    This is the first time I've seen your video 50 minutes after it was uploaded.

  • @sonu-jangir

    @sonu-jangir

    15 күн бұрын

    Amazing Intro... 🎉🎉🎉

  • @sonu-jangir

    @sonu-jangir

    15 күн бұрын

    I'm Very existing to watch this video... ❤❤❤

  • @gigelin6944
    @gigelin694415 күн бұрын

    You are amazing man

  • @mightbeeseventyseven6032
    @mightbeeseventyseven60324 күн бұрын

    please be advised that in order to be able to properly use FRect in pygame you must have the pygame community edition installed. The original pygame does not support frect...

  • @abdalrahmanmoh.elbanna3998
    @abdalrahmanmoh.elbanna399815 күн бұрын

    This is so helpful

  • @WolfCodeDev
    @WolfCodeDev15 күн бұрын

    plz make another godot course ur courses is great❤❤❤

  • @fekeks
    @fekeks15 күн бұрын

    Very nice! Is it possible that we will see some more Godot videos in the future?

  • @ClearCode

    @ClearCode

    15 күн бұрын

    will focus on Godot for the rest of the year!

  • @fekeks

    @fekeks

    15 күн бұрын

    @@ClearCode I'm looking forward to it!

  • @newsagetalks
    @newsagetalks10 күн бұрын

    I would have sworn that part at the beginning wasn't there before. 😅 Regardless, a great video guide on game development.

  • @dinsm8re
    @dinsm8re14 күн бұрын

    the goat has returned

  • @IainEmslie
    @IainEmslie15 күн бұрын

    The man, the myth, the legend!

  • @anthonydrakefordshadow
    @anthonydrakefordshadow15 күн бұрын

    Good morning from Carolina 🎉

  • @ScrapyDo0
    @ScrapyDo015 күн бұрын

    oh shit here we go xD. thank you

  • @nqv1228
    @nqv12288 күн бұрын

    finally, some good action :)

  • @pichuelanewman7135
    @pichuelanewman713515 күн бұрын

    Yipee clear code video

  • @billylee5624
    @billylee562413 күн бұрын

    I can't wait to see the choice of AI in the vampire survivor game, I need to step it up with programming AI next.

  • @abdalrahmanmoh.elbanna3998
    @abdalrahmanmoh.elbanna399815 күн бұрын

    Keep going

  • @user-of1zx5jg5u
    @user-of1zx5jg5u13 күн бұрын

    先生,我是国外的蟒蛇初学者。希望大家能为这个高质量的教学视频添加字幕。谢谢。

  • @-ex-acto8830
    @-ex-acto883015 күн бұрын

    We want flet course ( over 40h )

  • @jojo-tm3nb
    @jojo-tm3nbКүн бұрын

    How to add spine animations in pygame

  • @deathtrooper0016
    @deathtrooper0016Күн бұрын

    I am following the code and I'm at 50:11 in the video and i can't use frect, Visual Studio Code says this when I try and run it "TypeError: unsupported operand type(s) for +=: 'pygame.rect.Rect' and 'float'" what can I do to fix this error and run the game properly?

  • @ClearCode

    @ClearCode

    Күн бұрын

    you need to add one point of the rect; like rect.topleft += vector

  • @MD-cu8tt
    @MD-cu8tt9 күн бұрын

    you the best ever !

  • @sergeantargentmrg3155
    @sergeantargentmrg315515 күн бұрын

    U r the GOAT

  • @user-bk1ws8hb4c
    @user-bk1ws8hb4c8 күн бұрын

    for some reason when I am following the space shooter part it says frect is not defined do you mean rect? can you help me define it

  • @ClearCode

    @ClearCode

    7 күн бұрын

    you have pygame installed but you need pygame-ce. Just uninstall pygame and then install pygame-ce via the terminal or powershell. I talk about it in the beginning of the video.

  • @saigonesepapaya
    @saigonesepapaya15 күн бұрын

    you're the best ever

  • @Choco794
    @Choco79414 күн бұрын

    you forgot to add the finishing the game folder for the vampire survivor game.

  • @ClearCode

    @ClearCode

    14 күн бұрын

    thanks for letting me know, fixed now :)

  • @Choco794

    @Choco794

    14 күн бұрын

    @@ClearCode Isn't int(keys[pygame.K_DOWN]) - int(keys[pygame.K_UP]) and keys[pygame.K_DOWN] - keys[pygame.K_UP] the same since True is 1 and False is 0 implicitly

  • @Choco794

    @Choco794

    14 күн бұрын

    also monster battle has only one folder setup instead of 5-6

  • @ClearCode

    @ClearCode

    14 күн бұрын

    I'm so bad at file management 😅 it's uploading now

  • @abhijithr5938
    @abhijithr59382 күн бұрын

    hey what theme do u use it looks nice

  • @ClearCode

    @ClearCode

    2 күн бұрын

    it's the default VS code theme + material icon pack

  • @zakiaabdlrhem7056
    @zakiaabdlrhem705620 сағат бұрын

    First off, you are the best person ever, second, i am coding along and at 4:41:07 in: CollisionSprite((obj.x, obj.y), pygame.Surface((obj.width, obj.height)), self.collision_sprites) The surface is black not transparent, Why is it doing that?

  • @ClearCode

    @ClearCode

    19 сағат бұрын

    are you calling self.collision_sprites.draw() in the game loop?

  • @zakiaabdlrhem7056

    @zakiaabdlrhem7056

    19 сағат бұрын

    Yes but it's drawing the surfaces black, they should be invisible that's the whole point

  • @ClearCode

    @ClearCode

    17 сағат бұрын

    @@zakiaabdlrhem7056 you don't want to draw them at all, the collision will still work

  • @ahmadabdulrazaq5440

    @ahmadabdulrazaq5440

    17 сағат бұрын

    Oh my god I did not think of that, thank you so much :)

  • @MindfreeLetsgo
    @MindfreeLetsgo15 күн бұрын

    Hi, I really appreciate your videos on youtube, we can learn so much from them !!! But I wonder what the differences are between your class on Udemy and videos on youtube, anything you didn't teach us here but only put on udemy videos?

  • @ClearCode

    @ClearCode

    15 күн бұрын

    This video is honestly better since I got 2 more years of experience since making the Udemy course :)

  • @TheProgrammer-up4hc
    @TheProgrammer-up4hc6 күн бұрын

    Hi - could you create a more modern 2d game using pygame for example a multiplayer shooting game?

  • @TheProgrammer-up4hc
    @TheProgrammer-up4hc6 күн бұрын

    HI-could you create a video about how to create a pygame game in nintento using px-python

  • @eyzake
    @eyzake9 күн бұрын

    attention everyone.. bro dropped another video(again not gonna watch it completely but well had to try)

  • @gattorwichar3984
    @gattorwichar398412 күн бұрын

    I love you man You want me to become superman in python

  • @migueljesus7768
    @migueljesus776814 күн бұрын

    finally!

  • @kiryonnakira7566
    @kiryonnakira756615 күн бұрын

    i cheated at "read the documentation and change the title", just typed "pygame change title" on google and clicked on the first link. Which was not the documentation but was the correct answer.

  • @ClearCode

    @ClearCode

    15 күн бұрын

    there are loads of websites for pygame :)

  • @lindenhamer4766
    @lindenhamer476614 күн бұрын

    Hi Clear Code, I’ve followed your Monster Battle one so far - but I’m encountering issue with functions that seemingly don’t exist in my pygame? I’ve uninstalled and installed pygame 2.5.2 but still have issues. Issues were with: get_frect() (I’ve had to use get_rect) Also pygame.key.get_just_pressed() causes and error. The alternative “get_pressed()” works but the menu messes up. Is there something I’m missing? Perhaps incorrect pygame version ? Any help would be great thank you!

  • @ClearCode

    @ClearCode

    14 күн бұрын

    uninstall pygame and install pygame-ce, it's the better pygame version with more stuff

  • @ClearCode

    @ClearCode

    14 күн бұрын

    uninstall pygame and then install pygame-ce, it's the better pygame with more stuff

  • @lindenhamer4766

    @lindenhamer4766

    14 күн бұрын

    Perfect, will give that a try! Thank you for the really quick response and thank you for the great tutorial so far!

  • @AxXis--

    @AxXis--

    11 күн бұрын

    @@ClearCode Hello there! I'm having the same issue, I did pip uninstall pygame and pip install pygame-ce but, it seems like I still only have the regular pygame, the frects doesn't work...

  • @ClearCode

    @ClearCode

    11 күн бұрын

    @@AxXis-- Can you uninstall both pygame and pygame-ce and then install pygame-ce again?

  • @DaviSilveira
    @DaviSilveira14 күн бұрын

    Could you do a course like this using UPBGE 0.4+ (Blenders Game Engine) Please!

  • @Enginor
    @Enginor7 күн бұрын

    5:15:48 > ZeroDivisionError: integer modulo by zero

  • @Enginor

    @Enginor

    7 күн бұрын

    fixed

  • @user-ig2kn8em3p
    @user-ig2kn8em3p8 күн бұрын

    What... I keep getting this attribute error: AttributeError: 'pygame.surface.Surface' object has no attribute 'get_frect'. Did you mean: 'get_rect'?

  • @user-ig2kn8em3p

    @user-ig2kn8em3p

    8 күн бұрын

    Woops didnt install pygame ce

  • @Gogei
    @Gogei14 күн бұрын

  • @sbonventure
    @sbonventure6 күн бұрын

    Thank-you for posting this. I love your tutorials and I've never been more interested in programming until I found Python and your Pygame tutorials. There's another youtuber who posted an interesting object oriented structure for capturing the game loop as a game object. I was wondering if you use that method or if you have any thoughts about it. The tutorial is at kzread.info/dash/bejne/nqR3uNBwpLS_kdY.html. Basically a Game class with pygame init in the init method and some other methods like get_inputs, and loop for the game loop. I can send you the code, but I was curious what your thoughts were about structuring a game this way and whether you use it or not.

  • @ClearCode

    @ClearCode

    6 күн бұрын

    heya, glad you like it! Just checked out the video, it doesn't die anything fundamentally different compared to how I set up the projects. If you check out the later projects I create a Main class that runs the game loop in a method.

  • @DavidBoura
    @DavidBoura14 күн бұрын

    Would it work with Pydroid?

  • @ClearCode

    @ClearCode

    14 күн бұрын

    yup

  • @DavidBoura

    @DavidBoura

    13 күн бұрын

    @@ClearCode This is fantastic!

  • @WillCuber100
    @WillCuber10014 күн бұрын

    i cant get the frect to work?

  • @ClearCode

    @ClearCode

    14 күн бұрын

    do you have pygame-ce installed? What error do you get?

  • @WillCuber100

    @WillCuber100

    14 күн бұрын

    @@ClearCode thanks that was why!

  • @fury4834
    @fury483413 сағат бұрын

    What IDE are you using?

  • @ClearCode

    @ClearCode

    8 сағат бұрын

    vs code

  • @BinBin-jl2lg
    @BinBin-jl2lg15 күн бұрын

    Wow...

  • @cariyaputta
    @cariyaputta15 күн бұрын

    Lovely coding weekend.

  • @fakerrain
    @fakerrain12 күн бұрын

    Alright...time to clear out 12 hours...

  • @ApocolypseChild
    @ApocolypseChild10 күн бұрын

    Please raise the gain on your mic or the level of your voice channel. The other sounds in the video are all the right volume but I can't hardly hear anything you're saying.

  • @bexplosion
    @bexplosion15 күн бұрын

    Personally, I prefer one big game rather than 5 smaller.

  • @namandeepekka5623

    @namandeepekka5623

    10 күн бұрын

    Try to appreciate .. no one asked your opinion

  • @Griffin519x
    @Griffin519x14 күн бұрын

    Someone may have just finished watching this video. It was uploaded 11 hours ago 😂

  • @Choco794

    @Choco794

    14 күн бұрын

    I finished it in around 6 hours by watching at 2x speed.

  • @umaphysio
    @umaphysio10 сағат бұрын

    I made a game that murders your brain in real life😅

  • @ClearCode

    @ClearCode

    8 сағат бұрын

    isn't that every videogame? 😁

  • @gaWalt
    @gaWalt4 күн бұрын

    I'm following along and coding the space shooter game. All the code worked great until I got to the part where I added "global running" to the collisions() function. I created the laser Group, "laser_sprites = pygame.sprite.Group()" . Here's my function: def collisions(): global running collision_sprites = pygame.sprite.spritecollide(player, meteor_sprites, True) if collision_sprites: running = False for laser in laser_sprites: collided_sprites = pygame.sprite.spritecollide(laser, meteor_sprites, True) if collided_sprites: laser.kill() For some reason the meteors don't register as colliding with the player therefore the game doesn't stop or end. I've gone over my code many times but can't find any errors. Do you have any suggestions? Thanks, Gary

  • @ClearCode

    @ClearCode

    4 күн бұрын

    are you assigning the meteors to the 2 groups when you create them?

  • @gaWalt

    @gaWalt

    3 күн бұрын

    Sprites are new to me. Where and how do you assign the meteors to the 2 groups? Isn't that being done in the 2 variables, in the "collisions()" function, "collision_sprites" and "collided_sprites"?

  • @ClearCode

    @ClearCode

    3 күн бұрын

    @@gaWalt when you create a meteor there is a groups parameter, for the meteors it should be all_sprites and meteor_sprites inside of a touple

  • @gaWalt

    @gaWalt

    Күн бұрын

    This is what I have: Meteor(meteor_surf, (x, y), (all_sprites, meteor_sprites)) I've been using the exact same code that you're using in the tutorial. I could have made a typo error but I've checked over my code several times and haven't found any errors. I can place the "terminate()" function inside the collision function, inside the "if collisions:" statement and my game ends when a meteor collides with the player.

  • @inFamousAssassiin
    @inFamousAssassiin13 күн бұрын

    Hey, how can you do the multiline highlight note/de-note? Keypress shortcut?