 And welcome everyone to Vectrec Part 3. This one, I'm actually gonna go ahead and do some live coding. And my plan is to get the shields working. So let's take a look at what we have and what we are doing. Now again, I am still out in the countryside. I don't have all my technology with me. That's why you're seeing OBS Studio pop up like that. But real quick, shout out to my channel members. These are paid channel members. They get benefits like early access to videos and access to private discord amongst others. So we have Snake shout outs, Kevin, Paul, and joining them is Yan, who have been members of the channel for one month or more. Invader shout outs, these are members who are joined the channel, but not quite one month yet. So Maad, Kim, Xiong, Phinez. And joining Phinez, some new members in the last couple of weeks, Peter, Uli, Bogdan, and Ezra. Thank you so much for supporting the channel. So let's take a look at what we've got so far. So if you recall, I've got these little Klingons and they are kind of supposedly shooting at me, but their aim isn't very good, I haven't fixed that yet. But I've got the Star Trek Enterprise in the middle and it can go around and it can shoot the enemies. I've also got Phasers. And the Phasers, I can't really aim them, it just shoots at the nearest enemy. And because you can just basically shoot forever, there's no limit to your power, you just devastate the enemies. So which is kind of cool. Anyway, so what I wanted to do today is I wanted to add shields to the game. So even though not everything's quite working yet, this is kind of the next step that I wanted to do. So to do that, I'm just gonna be using basically the same whole kind of vector concept that we were using earlier and use that to draw the shields. So what I did was I took my original vector drawing, which I made in Google Sheets, and then I went in and drew some shields. So this will give me the coordinates of the shields. And I did the same thing for the clean one. The clean one is not quite as well done as the Enterprise one, but that's okay for now. So basically what I gotta do is I gotta make these coordinates just like I did with the shapes. So let's go and see if we can find that section of the code. There we go. So I'm gonna call this StarshipShieldShape. ShieldShape. And notice I do like very consistent naming conventions. And this is gonna be a tuple of tuples. And I'm not sure quite how many lines there are, but there's quite a few in this. So we may start hitting kind of the rendering limit of the turtle module. And so I may end up switching this over to Pygame at some point, but this is really just for fun. It's more of a tech demo than a full game that I'm playing to make. And I don't know, we'll see where life takes us. So I'm gonna go ahead and pop that over there. And so I'm gonna go ahead and start, I'll just start here. We'll start at negative eight and six. So negative eight comma six. And then it goes over to negative two and six. Negative two comma six. And then it cuts down to zero four. Zero comma four. And then negative one and three. This is pretty complicated, or just a lot. I should say it's complicated, just a lot of typing. And then it goes over to zero and two. Yeah, I think it's gonna slow things down, but we'll see how it goes. And then that goes over to two and two. Go up to five and five. So I don't know how exciting this is to watch as far as a coding thing, but this is the process. So 10 and zero. 10 comma zero. And then it cuts down to five and negative five. See that's how everything is pretty much a mirror image of everything else. And it brings us over to two and negative two. Two comma negative two. And that'll help with the rotations. Then zero, negative two. We need to add some more copy and paste, I suppose. Okay, so we were at zero and negative two. So I'm gonna go to negative one and negative three. And zero and negative four. Negative four, negative five. Down to negative two and negative six. Negative two, negative six. Cut us over to negative eight and negative six. Negative eight comma negative six. Yeah, this is probably gonna slow things down. That's a lot of lines to draw, but probably time. And negative 10, negative four. Negative six, zero. Now I could simplify things, but I think it looks better this way. Negative 10 and four, negative 10 comma four. And back up to negative eight and six. Negative eight comma six. Now at this point, what I'm gonna do is I'm gonna try and get the shields working for the enterprise. Instead of worrying about the Klingons at this point, because if I can get the code working for the enterprise, then it's just basically a copy and paste. So let's go ahead and hide that and take a look at our code here. Now, coming back to something that I haven't coded for a while, I often kind of forget what I did and how I did it and all that sort of thing. So we have a shape. Let's see here, how do we actually draw shapes? How do we render these things? So render. So we basically can make a vector shape. Okay, so, hmm, okay. I'm gonna try to make this part of the Starship class itself. So I'm gonna say self.shieldShape equals add shieldShape here, shape, all righty. And then down here when I create the Starship to add shieldShape at the end, shieldShape at the end. I'm just gonna run this and see if there's any errors. Yeah, shieldShape. Ah, okay, this should be, what is it? Starship, shieldShape. Okay, so that's good. So now we gotta do is add the rendering of that shield. So let's see how we can do that. Let's see here. I think I'm gonna have to change this in a bit. Actually, no, I think about this. Let's go back to Starship. Okay, so rendering is done in the vector shape class. So, okay. So actually the shields have to be a vector shape as well. Okay, so all right, equals vectorShape and the shape is shieldShape and the X is gonna be the same as the player's X, same as H, same as H. Scale, the scale's gonna be one. Okay, okay, so let's go back, that's fine. Okay, so the shield is a vector shape. So then what we have to do is when we render, so when we move it, we're gonna have to render it. Okay, so let's go ahead and render shields. I don't know if this is the most efficient or way to do this, but let's go ahead and try that. So I'm gonna say self.shield.render. Because it's a vector shape, I should be able to use that render method. And we also have to say self.shield.x equals self.x. So we gotta make sure the shield moves to where the player is. Self.shield, all right, sorry, H equals self.h. I think those are the three things we need. Let's try it, see what happens. Yeah, aasha, okay, pen, all right. Forgot to add the pen render, and I gotta use the pen to do that. Don't know if that's gonna work. Okay, well, it's kind of working. Well, I think it is working actually. It's just the shield's the same color as the ship. So it looks a little bit weird. Okay, so all right, let's change the color. Yeah, I really forgotten how a lot of these things work now. Self.to.color. All right, easy peasy. So let's make the shield color green for now. Okay, it's working, but you can see how it's not quite the correct scale. So is the Starship a different scale? That's probably our next question. 2.0, that's why. Okay, so that is the scale of the shield. All right, I can do that, I can do that. I put one here so it should be 2.0. There we go, very cool. All right, so now we've got shields. They're hard to see on the screen, but we've got shields around the enterprise. That's just what I'm very happy with, which is what I wanted. Now they're not very thick shields, but we can deal with that later. See here, yeah, we'll deal with that later too. So I'm gonna go ahead and just kind of copy this code. Actually, no, I gotta do the enemy bird of prey shield shape. I hope the Star Trek people have a sense of humor and don't sue me. All right, so let's go equals. Let's put a bunch of these in there. All right, so let's go ahead and pull that up. Okay, so the clay on the shields are a little bit less complex. I probably could have brought them in a little bit, made it a little bit more form-fitting, but I'll leave it like this for now. So it's gonna start at negative seven, eight. Negative seven, comma, eight. I'm gonna go over to negative three, eight. It's gonna shut down to negative one, six. Six, down to negative one, two. Over to two, two, two, coming two. Up to four, four. Negative two, negative six. Negative three, negative eight. Negative three, kind of negative eight. Negative seven, negative eight. Two, negative nine, negative six. All the way up to negative nine, six. Negative nine, and back up to negative seven, negative eight. All right, so that one's actually a little bit shorter than the Starship one. So I'm gonna go ahead and just copy, basically kind of copy the code that I did for the Enterprise and the Starship, what should I say? So that down to the enemy class. And we'll give the white shields instead. And then we need to do the rendering. And that's how, because we're using classes, I don't have to change too much of the code because we use self. That's another one of the advantages of using classes. Let's go ahead and try this, see what happens. Shield shape is not defined, okay? So I forgot two little shape. I need to send bird of prey shield shape. Okay, let's see what happens. 172, I think I put it in the wrong class didn't I? It's on torpedo, not the enemy. Yes, all righty. Okay, so the shields are working. There's something's a little bit off. I made a mistake somewhere in the numbers, but you can see how they now have shields which is kind of cool. And you also can probably notice how things have slowed down a bit too. So I gotta think about that. I might have to end up just like making the shields just a square or something to, because circles are a little bit expensive to draw as are these, but that's okay, I can look at this. Let me go back and just check those coordinates real quick because I think I missed something somewhere. Bird of prey shield shape, wasn't very smart, no was it? It was down here that there happened. So let's go ahead and see what I missed. Let's go work backwards. Negative seven, negative eight, not negative eight. Okay, so yeah, the shields look about like they're supposed to I believe. But you can see how things have slowed down a little bit. I maybe can't tell, I'm not sure. But I can, except for now I can look at that. It's kind of cool I can fly around and just kill all these clingy ones which makes me really happy. So I might change some of the colors around, but basically that's what I wanted to get done today. So I'm pretty happy with this. So I was able to add some shields and probably what I wanna do is make it so that as the shields get weaker, you know the color changes and that sort of thing. But let's save that for another day, especially when I get all my, when I get back to Tokyo and I can draw things correctly. So real quick, let me just kind of review what I did. I started out with some new vectors and basically I took my original vector drawing shapes, drew the shields around them and did the same thing for the clingy ones. I thought they're not quite as nice. I probably could have come in here and done it like that a little bit. But you can see how it's slowing things down. So I might wanna also consider that, maybe just kind of make it a bit more, like a fewer lines. It won't look as nice, but think about that one, think about that one. And then basically using the same method before as with the starships and the other objects, basically just added a shield shape, made it a vector and then in the move method, I ended up rendering the shields here because the move method is called every single time. So I'm gonna ignore that, because I'm running out of disk space. So I think it's a good place to stop. Thanks for watching. Subscribe if you haven't, ring the bell. And if you're able to join these fine folks and become age handle member, take care.