 Hello everyone, welcome to breakout live coding using pygame. This is a video I just wanted to try today and see if I could do a little bit of pygame I don't know a lot about pygame, but I'm gonna do my best now I am not at home with my normal equipment, so you'll see weird artifacts like this We smell OBS studio there so let me pop over to my Programming editor, which is genie genie.org. It's free. It's open source and cross platform And quick shout out to my channel members Kevin and Paul who are snake members They have been on the channel for one month or more and my invaders who have been with the channel stay there in their first month Yon mode Kim Sheung and finesse. Thank you guys so much So what I want to do today is see if I can program kind of an old-school breakout game Using pygame now. I have not done any pygame ever since I did my side shooting games Let me just show you what that looks like and so this is something you can check out the videos. There's three of them Okay, well, that's really loud I forgot about that so this was this was what I did with that game It looks pretty cool. I'm pretty happy with that So I don't remember any of the pygame stuff to be honest So I'm gonna be using this as kind of a model and then I also have my collision detection stuff over here I think it's also in here But I want to use some of the collision detection things This is something I often do when I'm programming something especially something I'm not super familiar with is to look at previous examples of things that I've done as you noticed earlier I also have opened a couple windows. So here's the pygame dot org docs and Something the one thing I didn't really know how to do For sure was how to draw a rectangle in pygame. I found this on geeks for geeks again. Nobody codes in a vacuum I don't know everything so I do do quite a lot of googling So, yeah, so let's see what we can get done here today in the time that I have so Basically, I'm just gonna go ahead and copy some of this stuff I'm gonna go ahead and import pygame. So I'm gonna copy that over here And what I want to do is I want to just kind of get my basic window up and running So this is some of the stuff that you need to get a Window up and running so I'm gonna go ahead and just copy those things and this isn't really a tutorial It's more of just kind of hopefully enjoy watching me code and I'm gonna go ahead and make set this up to 1200 by 800 I think 800 by 600 is a little bit too small in this day and age. So I'm gonna go ahead and call this Yeah, break out break out by Tokyo EdTech and fortunately, I can't do this live because I am out of Town right now. I the internet here is not that good. So Yeah, when I live coded the original program, I was talking about the side scroller I got a lot of help from the viewers. So thank you so much. Again, I don't know everything Everybody's learning and so if somebody tells me something and then I use it in a later video And I don't give you credit. I do apologize. Just so some time. It's not personal So yeah, we got that and let's see here Okay, so we got create the screen So I'm gonna copy that code over there. So basically, I just want to get that basic window up and running That's hopefully what we'll see here. There's a bunch of class stuff here. I may copy that later See here fun, so we're not gonna be doing anything with that yet We do need our main game loop and I'll go ahead and Copy that because I think we definitely need that Yeah, I'm just gonna guess in here what I need So hopefully, okay, so we got render. This is where we draw stuff. So screen dot fill. So I'm gonna copy that and that's gonna go into the while true loop and You see here black is not defined because I didn't copy that section of the code Let's go ahead and copy that. We'll definitely be using black white and green. So let's go ahead and copy all of those colors and Notice that they're in capital letters just because they are what we call constants. They don't change. So we keep them In capital letters. It's just kind of a convention. You don't have to do it But if you don't the other coders will make fun of you so render surface clock tick, okay, and I think that's it. I think that's what we need This is hopefully I Put the flip the display. Hopefully this will give us a blank window and set the Clock the FPS the frames per second and so what this does is gives us 30 frames per second So no matter what computer we're on it should look the same. So I'm gonna go ahead and run this and see what happens Okay, well that was exactly what I wanted. So I have a blank screen And what was the exit key? Quit Just close this Okay, okay. Well, that's okay. I can look at that. You see I've got sys.exe it there. I'm gonna go ahead and import sys Got a little error Yeah, okay, so here we go. Let's go ahead and Create some of our objects on our screen. So We have a player. So again, I'm going back to my side scrolling shooter. So Class player create classes Now this game was far far more Complex So I'm just gonna go ahead and copy this part. This is really I think the only part I need for right now So create classes again, this is a bit more of an advanced tutorial if you're not familiar with classes check out my class tutorial and there'll be a link hopefully down below if not remind me and So The player I'm actually changes the paddle because the player is a paddle in this particular game So DX so the paddle is gonna start at zero. I'm gonna start it out at negative. Oh That's right pie game pie game. The coordinates are a little bit different. So I'm just put that back Let's run this real quick. So we got to think about this. So those of you who've seen my turtle module Tutorials, you know that zero zero is the center of the screen. However in pie game. This is zero zero This is positive X. I think this is positive Y. So remember it's 1200 by 800 So that means we'll put it down here around 700 And so when we start the game, I Think that's right. Now DX is the left and right speed. So when we start out, it doesn't move at all So let's go ahead and create a render method for this So we want to render the paddle and since it's a class. We got to use self now Again, I don't remember quite how rendering works and that's why I opened up this Thing I was looking for how to draw a rectangle because the paddle is a rectangle and you can see here drawing a rectangle So I'm just gonna go ahead and Copy that and pop that over into my own code So it's pie game. I've imported pie game. That's good. Draw a rectangle surface is The screen so I'm gonna change that to screen. I think The color is gonna be white We define white up here And it is a pie game rectangle and this is 30 30 60 60. I don't know what those mean so Yeah, I don't know what that means. Let's go ahead and run that and see what happens. Oh, we got a render So I'm gonna go ahead and draw stuff. So draw the screen. I'm gonna say render objects So I'm gonna say paddle render Paddle is not defined. Okay. I created the class but did not create the object so creates name objects So paddle equal again, if you don't know what classes are, it's probably won't make a lot of sense But again, if you watch the video, it's I think explains it pretty well Okay, so there is our paddle so clearly I drew a rectangle at 30 30 Down to 60 60. So that is not what we want Alrighty, so I'm gonna go ahead and say self dot width. I'll give the paddle with just for now I'll make it 100 and self dot height equals 50 So when I draw this The paddle it's gonna be at self dot x minus self dot width divided by two and then it's going to be at self dot y Minus self dot height By two So that's the top left corner of my object and The bottom right corner is gonna be self dot x plus self dot width divided by two and self dot y plus Self that height Now I could have hard-coded this I could have put the numbers in there But in case I need to change the width and height of the paddle this should work. So let's try that Yeah, I see nothing That's a bad thing Okay, let's give me a little warning down here about Divisions and things I think I have to put 2.0 or maybe I got to change this to integers and not 100% sure But anyway, that did not work. So let's see what's going on here And the original one worked X minus self dot width divided by two heights Plus width No to me that should work But it isn't that go for now So that's why so zero. Let's just put That should be right So with self that height now probably people watching home prior I figured out but It was dressed out when I think people are watching me and I don't know what I'm doing It's really darn annoying alright, alright, so Here's what I'm gonna do is I gotta try and figure out where I went wrong. So Right here was because of that warning. Let's go ahead and It says it says it was working so It's stuff like this that really annoys me when I'm working with libraries Because every library has like its own weird little quirks and it's probably one of the reasons I stick the turtle because I know all its quirks All right, and now I'm definitely annoyed Let's see so heights with heights Let's change that to a different number to see what happens doki lovely All right, so I'm gonna do is I'm gonna go back To the original code and I'm just gonna put the numbers in I hate the scrolling on this too Sorry, it's morning. I'm annoyed I usually I usually pretty easy going at it to you, but this is this type of stuff just annoys me no frickin end That's right. So it was 30 30 60 60 All right, let's run that and see if that works Unmatched again. Okay, that's fine So now I expect this should be zero minus one heart. So that should be minus 50. There's the problem Okay, I'm gonna undo everything I had was correct I'm so annoyed right now. It's cuz x is not zero. It's because it's cuz the stupid coordinate system in pi game Sorry, it is a stupid coordinate system. So we're starting it at width divided by this would be this is be 700 This is width divided by to Wait, okay. It's a little big We can fix that I'm guessing it's just that type of thing. They just need some extra princes, I don't know Yeah, this is like the really annoying thing about coding is when you're you have something really stupid. That's just shouldn't be happening So that's all right It's not quite working. All right, but it's working a little better. Yeah, I didn't expect to spend 15 minutes drawing a frickin paddle But it's good to see this it's it's definitely something that happens quite often That's right Okay This is where you know people like me who don't like to read documentation This 60 is not the bottom right coordinates. I should just read this Yeah, so I should have looked up what what a wrecked object is. This is probably the top left top, you know top left Top top. This is probably the width. It's not the the y-coordinate So that would explain it. So then that would make this self dot width Just a guess, but that's probably what it is and this should be Self dot height thingy there. There you go. All right, so I'm not happy with the size of that. I think it should be a little smaller Make the height smaller and make it a little bit wider on the screen That's another good reason to use variables rather than hard coding everything. Okay, that looks like a paddle for the game All right, so Now I can move on and not be so upset about that But you can see it just gets frustrating So when people are frustrated when they code my students particular I can totally relate But that is the process again one option is to do what I did and to sit there and fumble The other option is just go and read the documents. So you should probably read the documents But I've never been type person to read instructions very much. Okay, so Finally got a stupid paddle working now I'm gonna go back to my side shooter and try and figure out how I move things So you can see here. I have a left and right. I have some move methods So I'm gonna go ahead and just kind of copy these because it kind of Functions the same there's some differences and so I'm gonna go back to my breakout program Again, you might consider this cheating you might consider this smart. I personally consider it pretty smart So I'm just gonna leave these numbers left and right so DX so DX is your left speed Do you want DX? D? Why would your up and down speed now since the paddle doesn't move? Up and down it just moves left to right. I can do that I don't need to move X and Y So X equals X plus DX Checking for border collisions. So now this should be X not Y There is no again. It doesn't move up and down. So I don't need that for this particular problem now the left border is less than zero, but it's plus the width self-dot width Equals zero plus self dot width Okay, so it will stop at the border and then if it's greater than The border is 1200 wide. So it's 1200 minus self dot width by 2.0 We're gonna copy that now. I could hard code it But if we end up changing some sizes and things we don't want to do that Now I need to be able to control the paddle. So how does that work in pie game? Again? I just don't remember how pie game works at all Keyboard events Okay, so I'm gonna go ahead and just copy this This is a lot of again. This is something I do quite often in my Own games is I just take stuff that I did and just reuse it. Okay again players not going up So I don't need that players not going down. I don't need that Now the player is going left so Oops Okay, so I need this part the event type This part I don't need just doing left and right Again, I don't use pie game very often. So I do forget these things Okay, and it's not player it is paddle. All right, so let's see if we can move the player right? It's not working. Why is that? Okay, I'm gonna close that and reopen it and see what happens All right, so say let's run it Okay, there's my paddle And it is not moving left and right. So that's a bad sign so And the answer is I Didn't call the move function Update objects so paddle That moved Okay, so we got a moving paddle. Wow That's a little slow. I think for this game, but so let's double that speed up Let's leave it like that for now Maybe we can speed it up later if we have to I can also be a power-up thing if you want to change this into Arkanoid later Okay, so we've got a moving paddle now. We need a ball Now the ball is gonna be a lot easier just because we already have a paddle So I'm gonna go ahead and just basically copy the paddle class and Make a ball class Now ball is gonna have an X and Y. It's gonna have a DX. It's also gonna be moving dy and The ball will be much smaller. So we'll make it 40 by 40 20 by 20 20 by 20 The ball doesn't have a left and right method because it just moves on its own It does need to move in the X and Y direction. So I'm gonna put the movement Y Y and dy there I will need to do something with Collisions for the top and bottom so I'm gonna have to go ahead and Deal with that now in this particular game You're gonna have different reactions based on whether it's the top or the bottom So I'm just gonna go ahead and do why so this is the top of the screen and It's height not width. So if it hits the top of the screen The dy is going to reverse Basically, so it'll come back down at us. Now if it goes off the bottom Oh, I shouldn't I shouldn't use 1200. I should use width and height I'm gonna fix that later. So I'm already way over Way behind I do want to get a working game going So basically if it goes off the screen at the bottom, I'm just gonna put it back in the center So I'm gonna say self dot X equals width divided by 2.0 and self dot Y equals width 2.0 I'm gonna go ahead I guess since I'll make it this width and this is the screen with it's not the ball width So we're not using hard codes now zero is always gonna be left So we don't have to worry about that one But we do need to do the width for the right side and I'm gonna go ahead and do that up here as well Should have done that initially With all right, so let's oh and we got to give the ball When it starts out wait the ball go One well make it go six and six That should move it up into the right. Oh, that's gonna move it down Because why it's negative on this one. Okay, so let's try this Okay, now again, I've created the class. I haven't created the objects So ball dot ball equals ball Okay, I do not see a ball Okay, so let's go up to the render method. Well, that should be working because that was all Didn't render the ball This is why I should just put everything into a list and which I will do eventually but there we go Okay, well, that's not too bad. Okay, some things are working All right, so I forgot about that. So if the ball hits So we look at the ball So if the ball hits the border we got to reverse the DX So it goes from positive to negative And this should be height yeah, this should all be height that should be with okay All right, you're hard to code and talk at the same time self.dx times equals line 76 Okay, so the ball is bouncing which is a good sign And it does return to the center and we got to do the collision with the paddle next, okay Alrighty I'm gonna call that a win for now I don't want the ball to start at there with the ball to start at height Divide by two point I want to start in the middle of the screen. So let's try it one more time Okay, so I always start going up into the right it'll come off and then it will Keep going in the same direction. I can live with that. Alrighty But yeah, okay, so next up is we want to deal with the collision of the ball and the paddles We want to bounce off of the ball and paddle so Now if I was using the built-in sprite Object that pi game has there's there's command built in that does this and that's That's probably what I should do eventually, but I don't know how to do that yet so what I'm gonna do is I'm gonna steal my collision detection routine from my collision detection video and In if you haven't watched the collision detection video, I strongly recommend it It's really really helpful to understand how collision detection works And so I'm not gonna explain what I'm gonna do here but this is where I'm gonna be using and It's called access-aligned bounty boss collision. It's gonna work perfectly in this particular program just because Everything's rectangular so Don't want to put it with the class I was gonna make it a separate Thing I'll put it in the class for now because it's probably better structure. So I'm gonna go ahead and Put this in here. Now. You notice it's using the math module. So that means I gotta go up here and import math Import down to Here self x. Okay, great. I don't need to change anything This is awesome. So you can see here. I'm using self x other x self y other y self with other with and these are the exact same things that I've already used Here so it's a good thing. I'm pretty consistent with the way I code stuff because that makes my life easier I'm gonna plop this into the ball class as well just in case we need that And I'm gonna leave it called a ABB collision just to be sure it's what it does. So Here's what I want to do So I'm gonna move the objects and then I'm gonna check for collisions And for right now, I only have one the ball in the paddle. So if ball dot is AABB collision with the paddle say ball dot dy Times equals negative one. So what that should do is that the ball in the paddle collide? It should reverse the dy of the ball. Let's see. Let's see how that works out for us And if it reverses dy it should then go in the opposite direction. Oh My gosh, it works. Now. I don't know what's gonna happen if it hits an edge or anything like that. Oops Oops I missed Okay, I'm pretty happy with that that looks pretty good This is awesome Okay. All right, so I think It's kind of it's funny the hardest part was drawing that stupid rectangle everything else is kind of coming together pretty nicely So the next thing is to draw some bricks So again, I'm gonna be just I'm just gonna copy one of my classes and Change it now bricks. Don't move They they do render. So I do need the render method They collision I can use I can put the collision method in there, too I'm trying to go ahead and put But I probably just keep it in the ball class, but let's go ahead and just leave it there for now. It doesn't matter What I should have done was made a parent object and then everything else was a child of that, but I didn't so my bad But that's what happens when you're just kind of coding off the cuff You know things like that happen that don't need to happen and like I said, so bricks don't move left or right They don't move at all. They do render and They do collide with the ball so I can leave that here. I want to take that We don't need I'm gonna use the ball because they they're always gonna collide with the ball So I don't have extra code. I don't need And see here, okay, so Brick now the brick when we start it we got to put it somewhere So I actually make this a little bit different. So X come I should have done this with the other ones as well But I didn't again. This is what happens. We don't plan things out. Why? Bricks don't move So I can get rid of DX and DUI and they do have a width. So we've got to pick a number let's let's let's make them 50 by 25 and Each brick is gonna have a color self dot color So equals let's just make them all green for now since that's the only other color I have I think out there Define black and white and green. So I'll put self that color here and I'm gonna just make one brick brick equals Brick and notice since I put the X and Y here. I gotta put I actually put it somewhere So screen is 1200 so that's 600 so I'm gonna put it 700 and In the middle somewhere 400 so 400. Let's try that Again down here. I got to do the same thing. I got it now the brick doesn't move So I don't need that and if I do need to render it. Let's see if it shows up. Okay, it does show up Now what I was hoping was that it would Be right where the ball is gonna be so I'm gonna move that over a little bit So let me get 650 This is what I'm trying to do is I'm trying to check for a collision. Okay, that's close. I Want the ball to hit it right as it comes out. So we see if it works or not Okay, fantastic. So what should happen if there's a collision is that? Let's go ahead and test that so if ball dot is a BB collision with the brick Okay, the ball reverses direction And what I'm just gonna do is I'm just move the brick for now We're actually gonna have to delete it later, but brick dot x equals we'll put it way off the screen at like, you know 12,000 Okay, so let's go ahead. Oh Actually works. Yeah, I think I can live with that Okay, so it kind of works I'm pretty happy with this. Okay, so now the next thing I got to think about Again, I know that the collisions aren't perfect. We may have to adjust those at some other point but what I want to do is to Basically create like when I start the game up. I always want to create a ton of bricks and so Think about how I want to do this Okay, so I'm gonna make a list of bricks Bricks equals that and notice my naming here. This is bricks because it's a list of bricks and I'm gonna say For why in range And it starts at zero plus. So I'm gonna start 25 Range 25 and the screen is 1200 wide divided by 25. So that's 40 That right probably So 40 so No, no, so 1200 minus 25 would be 1175 and I want bricks every 50 or x in range All right, so that's that's the that was wrong. That's that's the x stuff 25 1175 and 50 the y is From the top at zero so they're falling to have high only at 25 Just do the same thing. We'll make bricks all the way down to How many rows we want to make a bricks? Make six rows so 25 56 3 Again, this is something I had to play with the numbers if I was really thinking this through So I'm gonna say bricks dot append brick x come away Get rid of that down here What I do is For brick in bricks and render all the bricks again, this is stuff I do in all my tutorials You know, so if you watch one of those it is a bit more step-by-step rather than just kind of this live coding You'll see kind of what I'm doing a Y It's next error unmatched parenthesis in line 121 parenthesis So don't need Okay. Oh, that is exactly what I wanted to happen. That looks way wicked cool. Oh, that's so cool I did not expect that to happen quite so easily. Oh, that's what I want to see. Oh, that's cool Now you notice kind of like one of the things that didn't happen there was it didn't really do the left right bounce like it Normally doesn't in breakout. I got to think about that one for a bit Okay, now one thing you can see here is I don't have it doesn't go all the way across so I gotta Fix that So it's gonna add this make this 1200 Hundred that's a lot more bricks actually than I thought so I'm gonna actually get this to start and around Because I want a gap at the top. So I'll say 100 Let's try that see what happens. Okay, that's a bit more what breakout looks like when you start the game And then what I want to do is I'm gonna go ahead and just kind of make a little bit more colorful So I got black white green Let's say red Zero zero and that's not red. I'm gonna fix that in a second Copy that we'll do those red. I don't actually know the other colors green and I wear a green We'll say blue Our size be 255 to be should be 255 And so what I want to do is When I create a brick glass say self-color equals random choice I'm just gonna put all those colors in there. So it's gonna be we have white bricks. We can have green You have red and you have blue. We should add yellow and stuff, but that's another problem for another day So I need that random module so import random Let's see what happens Okay, there we go. We can progress and it's just it's just well if like I'm back in 1980 Yeah, you might want to make the bricks a little bit bigger. You might want to make them You know, so it's as pretty tiny I guess but I just kind of guesstimated the numbers And you can see there's no real way of Getting rid of the bricks and stuff, I mean, they're just off the screen. They're still actually there The objects are still there That's the best way to do it but But it is a way to do it It's basically I've just moved them all way off the screen So you can't see them anymore and then that comes down and that's gonna keep coming down Let's just do real quick. Just go ahead and throw in the score here Since that's already in here. So in This game I had this thing where it says render the score So that's score surface, you know that even means I come up here There's a lot. There's a lot to pie game that I just don't never quite really internalized Copy and I'm gonna paste that over here So before I flip the display, I'm gonna say render the score. Okay, so score is gonna be player score and that should be at With Again, I'm doing it this way. I'm using the width So if I just if I just change the screen size like 800 by 400 it work a little bit differently You know, I kind of hard-coded these numbers in here. So that's something I want to think about Um, let's just render player score the player does not have a score. Let's go ahead and It should be paddle so self that score equals zero So it should be paddle and when we get a brick Player that score plus equals 10 Doki Font is not defined. Okay, I got to find a font apparently So we're gonna do that font equals there we go Okay, so create font it's gonna go up here before I create my objects and create my font And let's hope comic sans works Player is not defined It is paddle so I could have called it player. Yes. Okay. There it is Maybe I can make that font a little bit bigger, but you can see how it's going up every time getting a point Or every time I'm touching one of the boxes or killing a brick, I should say Yeah, this is Yeah, it's kind of working. Oh, I knew that was gonna happen, but I'll leave that as it is and I'm gonna sleep over that one I would like to see what happens if it gets into like a whole little alley of Bricks, but you know what? I think I can live with this Last thing I think I want to add she's gonna make that font bigger because that's really tiny I'm gonna double that there. That's a little better and It's not very centered. So it's gonna have to be at the width Minus probably about let's try that. That's a little bit better It still move that over I have to play the numbers a little bit on that one to get it 50 See if this is centered So it's not quite centered, but as the score goes up it might send her itself And let's do my 75 Yeah, it's a little bit better. All right. I can live with that. Um, let's see. What else sounds this over here I do have sounds in here So what I want to do is I'm gonna show you how I do sounds real quick and I use a website called the sound Bible And it's just got a bunch of free Sounds so I'm gonna go ahead and search for a bounce and you just kind of play and see what you find that you like So here's what it's called bounce And I don't like that all Definitely not Yeah, definitely not that you We'll go with jump. I like that one So you can see here I can download the wave or the MP3 I tend to download the wave just because it usually is a bit more What I call it Compatible so what I do is I got to make sure that download is In the same folder So I'm gonna copy that to the same folder as my breakout.py file paste That's really long. I'm gonna call this bounce Dot wave So Again taking a look at code that I've done before so I need to create the sound first So to back to my breakout game Where was that? Create all that stuff up here Classes there you create font gonna create sounds And this was I think bounce that wave And then how do we play a sound? Yeah, so it's the sound name dot play so let's bounce sound and so So it's gonna play when we touch the paddle bounce Sound dot play When it hits a break, okay, I knew that was gonna happen Right now that might get a little annoying turn it down a bit. Okay, I can live with that Not the greatest sound it's a bug or if that's a feature, but it kind of works out. That is a basic breakout game I'm gonna leave it at that. I'm pretty happy. I wanted to put about an hour into this It's been about an hour You know except for that stupid thing getting the paddle to render It was a pretty straightforward program again. You notice how again, I don't have all this stuff memorized I had to do some googling and I was using some stuff that I created before it's like a little, you know It's a kind of a reminder. So there's nothing wrong with doing that You just got to be able to adapt it if you understand it well enough to do it in one program Then you should be able to understand it well enough to adapt it to another program again I know the code isn't a hundred percent clean and efficient There's a couple, you know things that we don't really need. I think we don't need this for the paddle Just needed it for the ball Let me try it see make sure that works still. Yeah Yeah Again, like if you're if you're more into pat big level design, you can make it so that each level has one color Let's do that. Let's do that because that's kind of how breakout looks. I think usually Because that's kind of annoying. Well, I know I gotta do. Okay to do that So Yeah, so I do this color equals random choice What was it white the black we want red green blue, I think were the four colors and then what we'll do is Bricks dot Bricks minus one this will give us the last one that was appended that color equals color So it should give us all rows of the same color Or not invalid color arguments Bricks Bricks Bricks Bricks Bricks Bricks Not a color. I don't think I mean Colors are in a choice. Oh Quotation marks. They are not strings. They are actually tuples RGB tuples or tuples and try that one more time There we go. I think I've had more colors. It would be a little bit better But I actually don't know the mixtures. So no red and green is yellow. Maybe But anyway, this is a you know, mostly fully functional game I don't have lives or a number of balls or anything included in that. I guess I could do it quick Let's go ahead and do that quick just for Make it a bit more complete now. Yeah, I'm gonna leave it at that. I gotta run. Sorry But anyway, check out, you know, I'll link this stuff down below about collisions and things like that There's also I did a video about creating levels that might come in handy with this also and again, I didn't need to I Don't know if this is the best way of doing it Was I moved all the bricks off the screen that were bad It's really not a good way to do it because they're still in that list and It's kind of I can get pretty inefficient since it's not gonna happen what we could do to To get around that as like, you know make a list called dead bricks and then dead bricks taught a pinned brick And then what you would do is once that's over is for brick in dead bricks Bricks not remove brick So that way you've created a secondary list a temporary list of dead bricks and Then that will actually remove them completely from memory. So we really don't even need this part anymore It's actually a better way to do it I think And you can see how it still works as expected So instead of keeping those bricks in memory and just in rents. I'm still running them off screen actually It just you know, it does it this way. It's a bit more efficient So, yeah, and that way what you could do is then you could say, you know, if you know length of bricks Equals zero I should just do less than or equal to zero just in case it shouldn't be negative then, you know prints, you know game over game over You know blah blah do whatever you want to do with the ending screen You know, I have all kinds of little videos about how to do these types of little things as well But I'm not gonna go ahead and do it in here I'm but I'm happy with you know kind of the the progress This game is made in just One short hour. So enjoy Hopefully, you know, I'll give you a little bit of hints on how to do some Pie game stuff again. I'm not an expert on it. I'm a turtle guy as you know And but it's pretty cool. Uh, I'll try and do a little bit more pie game stuff in the future Now that I'm getting used to it, but I really do need to learn how to Do some of their Other, you know, like use the the sprite class that they have which has which rotates and does a lot of cool things So, yeah, that's it. Uh, again, thanks everybody for watching Members especially for supporting the channel subscribers. Keep on subscribing if you haven't subscribed Subscribe below and uh, check out down below for all kinds of links and uh, different things Thanks for watching. Have a merry christmas