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
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!
Dude stop releasing tutorials at such high quality and so fast I cant keep up!😅😅😂😂
Amazing. I love these in depth tutorials. Bookmarking this for later!
I just started, thank you so much for this huge course!
Instructions unclear, accidentally made minecraft 2.0
@Doubleshotgun
15 күн бұрын
Wow, you must be a fast learner
@CodeKokeshi
11 күн бұрын
I made a catch the bullet in head disease and how far can you get from jumping on a building game.
I love how clear all of your explanations always are!
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.
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
15 күн бұрын
Christian and DaFluffyPotato are pygame legends!
@Choco794
14 күн бұрын
@@chigstardan7285 They should team up to make something, it would cool.
@Choco794
14 күн бұрын
@@chigstardan7285 They should team up for something. That would be cool
this is crazy, im loving these tutorials im learning loads, clear code might be the goat
I am amazed that a tutorial like this is available for free. Hats off to you, sir and thank you so much
Thank you Clear Code! This is awesome!
wow you realy leveled up your explanation, the vizuals at the start are great!
Wow, this is probably the best and most comprehensive tutorial on how make games with pygame on yt. Thanks
Amazing! Keep up the good work!
Thanks for this and every other video. I'll watch everything.
thank u very much i learned python from u,keep up the good work sir
This is exacly what I needed!
This is just amazing for real. I cannot believe this is for free. You sir, are a legend.
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
Amazing tutorial, thank you!
you are a godsend bro, keep it up
man you are a legend thank you for all the effort
Great work. Hope you make similar tutorials about web games
Can't believe these resources are free ! You are amazing
you should have much more subs for it being so good 🔥
You have a gift for teaching!
Wow only been 30 minutes into the video I'm already thinking about creating art and also making it move this is awesome
Awesome course!
Between this and your discord, i owe all the vast majority of my programming knowledge to you, thank you so much for your help.
One of the best coding guides ever. I am 14 and Italian, so not even english, and I understood EVERYTHING
You're so underrated my guy ❤
Best pygame tutorial by an expert❤
Thank you once again, teacher.
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
22 сағат бұрын
hey, thank you :) It should be the same, does it look different?
@ahmadabdulrazaq5440
22 сағат бұрын
Thanks for replying, it does look different, though it does look like a normal map, but different than yours
@ahmadabdulrazaq5440
22 сағат бұрын
Im pretty sure they are the same but the video has more objects (ex. more trees in the upper-left corner)
@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
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?
You are the best!!!! Thanks!!!!
Any plans on a series (possibly incorporating godot), books, or collaboration one day?
OMG! I love this!!! 🎉
You are the Legend!
This is the first time I've seen your video 50 minutes after it was uploaded.
@sonu-jangir
15 күн бұрын
Amazing Intro... 🎉🎉🎉
@sonu-jangir
15 күн бұрын
I'm Very existing to watch this video... ❤❤❤
You are amazing man
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...
This is so helpful
plz make another godot course ur courses is great❤❤❤
Very nice! Is it possible that we will see some more Godot videos in the future?
@ClearCode
15 күн бұрын
will focus on Godot for the rest of the year!
@fekeks
15 күн бұрын
@@ClearCode I'm looking forward to it!
I would have sworn that part at the beginning wasn't there before. 😅 Regardless, a great video guide on game development.
the goat has returned
The man, the myth, the legend!
Good morning from Carolina 🎉
oh shit here we go xD. thank you
finally, some good action :)
Yipee clear code video
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.
Keep going
先生,我是国外的蟒蛇初学者。希望大家能为这个高质量的教学视频添加字幕。谢谢。
We want flet course ( over 40h )
How to add spine animations in pygame
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
Күн бұрын
you need to add one point of the rect; like rect.topleft += vector
you the best ever !
U r the GOAT
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
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.
you're the best ever
you forgot to add the finishing the game folder for the vampire survivor game.
@ClearCode
14 күн бұрын
thanks for letting me know, fixed now :)
@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
14 күн бұрын
also monster battle has only one folder setup instead of 5-6
@ClearCode
14 күн бұрын
I'm so bad at file management 😅 it's uploading now
hey what theme do u use it looks nice
@ClearCode
2 күн бұрын
it's the default VS code theme + material icon pack
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
19 сағат бұрын
are you calling self.collision_sprites.draw() in the game loop?
@zakiaabdlrhem7056
19 сағат бұрын
Yes but it's drawing the surfaces black, they should be invisible that's the whole point
@ClearCode
17 сағат бұрын
@@zakiaabdlrhem7056 you don't want to draw them at all, the collision will still work
@ahmadabdulrazaq5440
17 сағат бұрын
Oh my god I did not think of that, thank you so much :)
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
15 күн бұрын
This video is honestly better since I got 2 more years of experience since making the Udemy course :)
Hi - could you create a more modern 2d game using pygame for example a multiplayer shooting game?
HI-could you create a video about how to create a pygame game in nintento using px-python
attention everyone.. bro dropped another video(again not gonna watch it completely but well had to try)
I love you man You want me to become superman in python
finally!
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
15 күн бұрын
there are loads of websites for pygame :)
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
14 күн бұрын
uninstall pygame and install pygame-ce, it's the better pygame version with more stuff
@ClearCode
14 күн бұрын
uninstall pygame and then install pygame-ce, it's the better pygame with more stuff
@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--
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
11 күн бұрын
@@AxXis-- Can you uninstall both pygame and pygame-ce and then install pygame-ce again?
Could you do a course like this using UPBGE 0.4+ (Blenders Game Engine) Please!
5:15:48 > ZeroDivisionError: integer modulo by zero
@Enginor
7 күн бұрын
fixed
What... I keep getting this attribute error: AttributeError: 'pygame.surface.Surface' object has no attribute 'get_frect'. Did you mean: 'get_rect'?
@user-ig2kn8em3p
8 күн бұрын
Woops didnt install pygame ce
❤
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
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.
Would it work with Pydroid?
@ClearCode
14 күн бұрын
yup
@DavidBoura
13 күн бұрын
@@ClearCode This is fantastic!
i cant get the frect to work?
@ClearCode
14 күн бұрын
do you have pygame-ce installed? What error do you get?
@WillCuber100
14 күн бұрын
@@ClearCode thanks that was why!
What IDE are you using?
@ClearCode
8 сағат бұрын
vs code
Wow...
Lovely coding weekend.
Alright...time to clear out 12 hours...
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.
Personally, I prefer one big game rather than 5 smaller.
@namandeepekka5623
10 күн бұрын
Try to appreciate .. no one asked your opinion
Someone may have just finished watching this video. It was uploaded 11 hours ago 😂
@Choco794
14 күн бұрын
I finished it in around 6 hours by watching at 2x speed.
I made a game that murders your brain in real life😅
@ClearCode
8 сағат бұрын
isn't that every videogame? 😁
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
4 күн бұрын
are you assigning the meteors to the 2 groups when you create them?
@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
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
Күн бұрын
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.
Hey, how can you do the multiline highlight note/de-note? Keypress shortcut?