Breakout in python

  Рет қаралды 58,132

Clear Code

Clear Code

Күн бұрын

A video creating breakout in python. The game includes flexible graphics, sounds, powerups and a cool retro look.
If you want to support me: / clearcode
(You also get lots of perks)
Social stuff:
Twitter - / clear_coder
Discord - / discord
Related videos:
Introduction to Pygame: • The ultimate introduct...
Deltatime: • Understanding framerat...
Timestamps:
0:00:00 - Intro
0:00:37 - Project setup
0:04:56 - Creating the background
0:13:42 - Creating the player(-ish)
0:30:18 - Creating the ball
0:51:14 - Collision theory
1:10:04 - Creating the blocks
1:35:46 - Adding proper graphics
2:21:07 - Adding hearts
2:27:57 - Creating upgrades
3:03:56 - CRT Styling + sounds
Github:
github.com/clear-code-project...
Pastebin:
Start file - pastebin.com/xkUTAV17
main.py - pastebin.com/ncP1Y1tK
sprites.py - pastebin.com/cUfT7jSU
settings.py - pastebin.com/eBjqDRZW
surfacemaker.py - pastebin.com/KWDLk6xX

Пікірлер: 49
@mixlaproduction
@mixlaproduction 2 жыл бұрын
I'm afraid we're not aware of what gems we have on this channel... Clear Code is a legend!!!
@matrixtoogood5601
@matrixtoogood5601 2 жыл бұрын
Probably the best PyGame creator I have come across! I would love to hear more of your ideas on object-oriented design (maybe SOLID principles, design patterns etc.) while developing games or GUIs. There isn't much good content on object-oriented design in Python (or PyGame). Maybe some multiplayer implementations over network using sockets would be awesome as well!
@matrixtoogood5601
@matrixtoogood5601 2 жыл бұрын
Personally, I feel that creating classes and objects for game entities is relatively easier but creating classes for providing functionalities like settings, stats, menu etc. is trickier
@subarunatsuki1902
@subarunatsuki1902 2 жыл бұрын
We all can agree on that!
@Monotoba
@Monotoba 2 жыл бұрын
I've watched and worked through many of your tutorials. I truly enjoy them and find their quality superb. I want to encourage you to continue providing tutorials and project videos for PyGame!
@magickaito
@magickaito Жыл бұрын
Absolutely.
@pitermg
@pitermg 7 ай бұрын
Great tutorial! Very well and thoroughly explained. I find your channel a real gem! By coding with you and listening to explanations I really do feel I'm getting better at understanding game programming. I enjoyed it very much!
@potatocat6855
@potatocat6855 2 жыл бұрын
YOU MAKE ME FEEL LIKE PROFESSIONAL!!!! love your content👍👍👍👍
@carlfranz6805
@carlfranz6805 Жыл бұрын
My only problem with this (and most of the other Breakout clone tutorials) is that it is deterministic. That is, the "angle of incidence (always) equals the angle of reflection". In this case the first and second ball cannot possibly be bounced by the paddle as the angles involved are larger then the possible paddle movement. Also, there is no way to vary the bounce. It is what it is and paddle movement during contact does not effect it. Other then that... Gotta love this guys teaching methods. Better then most of the rest. Still... Take PirateMaker for instance. It should have been constructed as a state machine because there are too many bugs in switching states between Editor and Game. Also his 'Delta Time' design needs more thorough. Not in design (very good) but in explanation. You need to spend some time explaining where you are going before you go there. Both theory and execution. I'd love to chat with Christian to get his take on how he designs his games. OTOH, I've not created any KZfaq tutorials so my 'bitching' should be takes with a grain of salt. That said... I've done a LOT of tutorials for various audience levels over my 35 years and have, I hope, learned a thing or two about effective explanation/presentation. This, apparently is a young mans game and I am no longer young. 🙂 Sigh.
@davecolburn1378
@davecolburn1378 4 ай бұрын
Excellent tutorial! Final product made look around for quarters… 😎
@diegoecp
@diegoecp 2 жыл бұрын
It is a fantastic tutorial. I have enjoyed a lot programming this game. The only thing you forgot was to end the game when there is no block left. Great job!
@Ajay.Tiwari
@Ajay.Tiwari 2 жыл бұрын
Best pygame tutorial creator on internet!!
@BeRaikwal
@BeRaikwal 2 жыл бұрын
new project to work upon and have some all nighters. WHY DO U DO THIS I JUST FINISHED UR ZELDA VIDEO AHAHAHHAH UR AMAZING MATE THANKSSSSSSS KEEP UPLOADING SOME NICE RPG GAMES TOO
@TZ-wg9kh
@TZ-wg9kh 2 жыл бұрын
Thx for this toturial
@saadedi75
@saadedi75 Жыл бұрын
clear and great code thanks for all
@diegoecp
@diegoecp 2 жыл бұрын
Instead of saving the old rect of the ball and the player, you can look at the ball direction. So, instead of looking if the ball in the previous frame was on the left or on the right you can see the direction x or y and deduce where it was. I think it's easier this way.
@brunorcabral
@brunorcabral 2 жыл бұрын
just using direction you can still have tunneling problem, he explains that in the collisions tutorial video
@diegoecp
@diegoecp 2 жыл бұрын
@@brunorcabral Thanks! It's true! I need to watch that tutorial!
@Mohossam
@Mohossam 2 жыл бұрын
Can you make 2d game thats feels like 3D gamws like the old racing games or doom 1 or way out 1983 something like that
@meIIo4649
@meIIo4649 2 жыл бұрын
That sounds nice
@lightd2471
@lightd2471 2 жыл бұрын
That's called 2.5d
@theunwaveringkeynote3293
@theunwaveringkeynote3293 2 жыл бұрын
You can checkout FinFET channel, he's doing something like that here: kzfaq.info/get/bejne/aL-aaNCesL3Zm6s.html
@Mohossam
@Mohossam 2 жыл бұрын
@@theunwaveringkeynote3293 yeah like that
@ranjeetkahar4691
@ranjeetkahar4691 2 жыл бұрын
sir' In pygame text animation, video is made in which animation is done on all type of text like text being zoomed and hidden, text moving, text showing in display one by one like story.
@Bezzegv1
@Bezzegv1 27 күн бұрын
i went to sleep watching a youtuber play kenshi, i woke up to this...
@tfwnoyandere
@tfwnoyandere Жыл бұрын
thank christ on a stick for this channel dude holy
@sheepybreaker
@sheepybreaker 2 жыл бұрын
AMAZING!
@mananbhardwaj3976
@mananbhardwaj3976 Жыл бұрын
Keep it up bro
@nicklansbury3166
@nicklansbury3166 2 жыл бұрын
You had me at "Breakout"
@uprola
@uprola 2 жыл бұрын
11:27 kids look, equations and algebra ARE useful! Computer graphics is full of such short equations and formulas, which are best to be solved in the head. Train linear equation solving to automatic!
@donmader3248
@donmader3248 2 жыл бұрын
Don M A really good tutorial for learning how to program in Python. I used this tutorial to learn the syntax and the use of different libraries. Question: I'm NOT sure why this happens with my set-up. The way I handled this exercise I typed the code as a guide while listening, I came across a problem in several of the steps and I was able to figure out to work around. As an example, in the determining the aspect ratio for the background (create_bg) function, I got and exception of a float not allowed in a tuple therefore not allowing the code to execute. It was NOT until I cast the 'scaled_width' & 'scaled_height' to an 'int' was I able to compile the code. This was also true in the 'get_surf' function, the images width & height had to cast to an int until it executed. Does anyone know why in the tuitorial it allows a tuple to accept a float and in mine it does NOT? See my example code Sample 1 def create_bg(self): bg_original = pygame.image.load('../graphics/other/bg.png').convert() scale_factor = WINDOW_HEIGHT / bg_original.get_height() scaled_width = int(bg_original.get_width() * scale_factor) scaled_height = int(bg_original.get_height() * scale_factor) ........... Sample 2 # top side def get_surf(self, block_type, size): .......... top_width = int(size[0] - (sides['topleft'].get_width() + sides['topright'].get_width())) scaled_top_surf = pygame.transform.scale(sides['top'], (top_width, sides['top'].get_height())) image.blit(scaled_top_surf, (sides['topleft'].get_width(),0)) ..........
@TZ-wg9kh
@TZ-wg9kh 2 жыл бұрын
The code doesn’t work for me it says that bg.png is not there when it is in the folder pls help
@imperialmuffin
@imperialmuffin 2 жыл бұрын
Upload the folder in ur IDE and not save the files only into the folder
@rochoe4575
@rochoe4575 Жыл бұрын
are you on windows? if so use ./ to go up in the directory tree and not ../
@Apish_Rana
@Apish_Rana 2 жыл бұрын
Please provide a zip file of graphics folder
@gawan3390
@gawan3390 2 жыл бұрын
Your content is fucking amazing bro, keep it up! :)) Btw, höre ich da einen deutschen Akzent heraus? xD
@raghavsood28
@raghavsood28 2 жыл бұрын
You should start making java tutorials ? Maybe LibGDX ?
@amburger1984
@amburger1984 2 жыл бұрын
But seriously good videos
@jstro-hobbytech
@jstro-hobbytech Жыл бұрын
It's Arkanoid when you add the weapons hahaha
@djhack3d981
@djhack3d981 2 жыл бұрын
❤️
@davnoa5958
@davnoa5958 Жыл бұрын
1. Okay, but why you need time.time() if you already have self.clock = pygame.time.Clock()? To set it as dt is as easy as: dt = self.clock.tick (variable in miliseconds). And you could add this to settings... 2. By the way, pygame.display.update() is updating whole surface like display.flip() if you don't specify object that you want to update on the surface. 3. You could've make one set of blolcks graphics in grayscale, and then assign colors needed wia health from COLOR_LEGEND, by multiplying or adding color values by blit() metod with alpha values somwhere near 33%. 4. You could use a spritesheet for little preformance boost by cutting draw calls and serach calls to one each. (will add more, after going through your video. But for now... Keep it up man!)
@carlfranz6805
@carlfranz6805 Жыл бұрын
time.time() is, in general, somewhat more precise then pygame,time.Clock(). That said, I really have no idea whether the difference is significant. I'd start with which is more efficient and work from there. Good luck. Let us know what you find out. I ran a thousand of each sometime back and found no significant difference. Both were around 0.036 (on a Raspberry Pi 3 overclocked to 1800mhz) in both average and mean. Sorry, I just don't remember statistical variance or standard deviation in either case. I apologise most profusely but I just didn't care enough to delve any deeper as I was working on a slightly different issue at the time.
@renegadezed
@renegadezed 2 жыл бұрын
yooo i requested that!!! XD
@gaydemaupassant6263
@gaydemaupassant6263 2 жыл бұрын
Erm... hi, I'd like to ask you to do me a favor.. Please could you make a chess video, that'll be fantastic. Really. Else, I am very impressed 👏 by what you are doing in this channel, Wish you keep going that way. Thanks
@ranjeetkahar4691
@ranjeetkahar4691 2 жыл бұрын
sir your video so good....
@amburger1984
@amburger1984 2 жыл бұрын
FIRST 3 TIMES
@DPoly
@DPoly 2 жыл бұрын
I think you have to work at your collision ball-paddle… this is the most important
Learning pygame by creating Snake [python tutorial]
2:05:00
Clear Code
Рет қаралды 332 М.
$50 Trillion Was Just Found Under Antarctica
17:41
hoser
Рет қаралды 475 М.
ONE MORE SUBSCRIBER FOR 6 MILLION!
00:38
Horror Skunx
Рет қаралды 13 МЛН
WHY DOES SHE HAVE A REWARD? #youtubecreatorawards
00:41
Levsob
Рет қаралды 33 МЛН
The most impenetrable game in the world🐶?
00:13
LOL
Рет қаралды 38 МЛН
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 20 МЛН
Understanding Pygame masks
1:00:29
Clear Code
Рет қаралды 38 М.
I tried coding my own graphics engine
4:23
Garbaj
Рет қаралды 183 М.
Making a Game in Python with No Experience
5:57
Goodgis
Рет қаралды 1,5 МЛН
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 89 М.
I’m kind of an iPad hater, but this is MAGICAL. - iPad Pro M4
15:03
Understanding decorators [Python tutorial]
42:31
Clear Code
Рет қаралды 24 М.
2 YEARS of PYTHON Game Development in 5 Minutes!
4:54
Coding With Russ
Рет қаралды 810 М.
The Surprising Things Emerging from the Antartic Ice
20:38
Astrum
Рет қаралды 123 М.
Easy pathfinding in python [almost without math]
1:11:12
Clear Code
Рет қаралды 82 М.
Every Python Project I've Ever Made...
8:51
Tech With Tim
Рет қаралды 62 М.
ONE MORE SUBSCRIBER FOR 6 MILLION!
00:38
Horror Skunx
Рет қаралды 13 МЛН