[User] Please transcribe this text

[Assistant] It's just, it got into the crowd and they just started chewing everything he was doing. This is genuinely, you keep doing performances like this, this is what gets someone over. It's this kind of stuff that they need to keep doing. I also loved the finish of this.


[User] Please transcribe this text

[Assistant] So, so good, so, so good, because after the back of a great match as is.


[User] Please transcribe this text

[Assistant] And then they're all celebrating like Dominic Miseru did it. It's wonderful.


[User] Please transcribe this text

[Assistant] Amazing, mate. Also, that turn of clash at the castle was genuinely one of the moments of the night.


[User] Please transcribe this text

[Assistant] Nevermind, we'll move on to the next one. But then they rehabilitated them. So, so great.


[User] Please transcribe this text

[Assistant] In the second one it's like, no, it's actual murder! He's trying to kill them now! He lights a rope on fire while they're climbing it off a building! That's not okay! Two comments in.


[User] Please transcribe this text

[Assistant] Genuinely, one of the most likeable wrestlers of all time! And they're making me not like him!


[User] Please transcribe this text

[Assistant] What reminds me of, more than anything else, is that the crowd chanted it. Which means they like it!


[User] Please transcribe this text

[Assistant] Fun match. Fun match. I enjoyed the wrestling between these two because they're both very good.


[User] Please transcribe this text

[Assistant] Boring. You are forgetting. The Elias Matt Riddle tribute.


[User] Please transcribe this text

[Assistant] Uh, he's now been taken to rehab. That is the official word. That's not what WWE have announced. They've just said that from Soros Oko is attacked from last week. He's out six weeks is the recovery period for this.


[User] Please transcribe this text

[Assistant] And that is to cover for, uh, Matt Riddle being sent to rehab. He was suspended. Second, uh, failed drug test reportedly. Uhm, so, Elias had a Matt Riddle tribute concert here.


[User] Please transcribe this text

[Assistant] And he said, I found this in Matt's locker room. And he pulls up and it looks like a joint, but it's actually a bit of paper with some lyrics on it. So we had to sing a song. And he said, I like you all my bro and all that stuff. And then he said, it's time for a solo. And then solo Sokoa came out. It was a nice touch.


[User] Please transcribe this text

[Assistant] It's not marijuana. WWE don't test for it anymore.


[User] Please transcribe this text

[Assistant] I know people really hate on the Samoan Spike, like people never really liked it before.


[User] Please transcribe this text

[Assistant] Yes, it's very good. Damien Priest was in glasses.


[User] Please transcribe this text

[Assistant] That's always gonna bump up a show.


[User] Please transcribe this text

[Assistant] I think the only thing that I really didn't like on this show was the Gargano Dexter Lumis stuff. Yeah, yeah. And pretty much everything else was either good or great. That's it. So low fall, I mean, I think. Yeah, I mean,


[User] Please transcribe this text

[Assistant] No, so we posted about this on Patreon, uh, there's the, uh, poll for WrestleTalk Extra for this month, which is, uh, a show that Luke and Ollie do where they review a retro pay-per-view, uh, once a month, like a really like long deep dive, like three hour deep dive into a wrestling pay-per-view from the past. Uh, the winner of the poll is Ring of Honor Final Battle 2011.


[User] Please transcribe this text

[Assistant] And unfortunately, Ollie was not scheduled to be on the show for this month, and we were like,


[User] Please transcribe this text

[Assistant] Well that won't fly, because that's a very Olly show, and we don't know when the next time a Ring of Honor show is gonna win the Restock Extra poll.


[User] Please transcribe this text

[Assistant] Absolutely, yeah. And if you have pledged in December specifically to get the rest of the extra episode, don't worry, you will still get it. Details of all of that are over on the Patreon page if you want to find out more. But yes, excited to see more. So we are going to delay it so Ollie can talk about Ring of Honor.


[User] Please transcribe this text

[Assistant] John Jenkinson, son of Janka. Golden John Moldan! The easiest name to pronounce, Josh Rozowskis.


[User] Please transcribe this text

[Assistant] Thank you, all of our pledgehammers on our Patreon page. Thank you, also I forgot to mention on the show that Corey Graves is trying to get over the uh, Dominic Mysterio should be called Caliente Mysterio. Now if you look at it in Spanish, Caliente generally means hot. However,


[User] Please transcribe this text

[Assistant] In Spanish, uh, from what I've been told anyway, in Spanish colloquialism, caliente also means horny. Which I think works for Dom!


[User] Please transcribe this text

[Assistant] You can make an argument for genuinely any member of the bloodline going first.


[User] Please transcribe this text

[Assistant] Roman attacking him to make the biggest statement. Jay attacking him because of their obvious tension. Jimmy for the unexpectedness of it. And Sola because he's the guy who's always stuck by Sammy and always been kinda his bodyguard specifically. There's an argument for any single one of them.


[User] Please transcribe this text

[Assistant] Yeah, but they did come alive for some bits, like your characters hour stuff. And booing Don Mysterio if you heard him for that.


[User] Please transcribe this text

[Assistant] Should I read that? Absolutely. It will be in a plain brown box labelled Giant Dildos to keep it discreet. ETA four days. So, I'm guessing by that Charles is sending us some calendars. Sounds about right to me. Yea.


[User] Please transcribe this text

[Assistant] Weird. Harry Hawker said, uh, Sorry to find out Pete's leaving Restless Hawk on his birthday of all days. So uhm, I clearly missed this Pete. What happened?


[User] Please transcribe this text

[Assistant] I feel like I've told this story before, but I'm gonna tell it again. Uh, so on the Survivor Series live reactions, on that day was the last time I was doing a Saturday. So on that show I said, not doing Saturdays anymore, moving over to Monday to Friday, so I'm not gonna be doing the SmackDown podcast anymore, but it is what it is. People then took that on the Survivor Series live reactions like, so sorry to hear you leave me off the talk.


[User] Please transcribe this text

[Assistant] I love our audience so much. And then of course, more people will come into stream and be like, wait, is Pete leaving WrestleTalk? No, guys, no, I'm not leaving WrestleTalk. Just not doing Saturdays.


[User] Please transcribe this text

[Assistant] Should I do these ones? Yes, please. B.M. Whitehouse, uh, said, Hi lads, uh, first of all, you need to start increasing your vitamin C intake or start drinking some green tea. Cause, immune systems and that, innit? I didn't get ill! Just got COVID.


[User] Please transcribe this text

[Assistant] Second, did either of you watch the Josh Alexander vs Mike Bailey match on Impact? It's my personal match of the year and it's free on YouTube. I heard very good things about this match.


[User] Please transcribe this text

[Assistant] Uh, we've got a screenshot here of, uh, Mr. Higglesby from the live chat. Thanks, Mr. Higglesby. Hello. Uhm, Kevin said, uh, just wanted to shout out Cathy Kelly's facial reaction during the K.O. and Elias segment. Uh, she was every one of us like, oh yea, you did smash a guitar over his head. She's the best. Glad she's back.


[User] Please transcribe this text

[Assistant] Uh, JD Rezzy said, uh, can I get an ass man clip, Luke?


[User] Please transcribe this text

[Assistant] We both got laid off from our work cause we both volunteered to be laid off because we


[User] Please transcribe this text

[Assistant] Wanted to get out of California, move to Colorado where it was beautiful and clean air and clean water.


[User] Please transcribe this text

[Assistant] I'd feel dizzy, uhm, I'd get bloody noses.


[User] Please transcribe this text

[Assistant] When they were drilling, we could feel it grinding underneath the ground, you know, under our, under our house. And then we'd feel these explosions. And it would shake dishes and rattle pictures and, and, uh, it drilled for the longest time.


[User] Please transcribe this text

[Assistant] And the pit was even closer and they'd burn it. They would just flare it off. The wind blew right to our house.


[User] Please transcribe this text

[Assistant] Then the gas companies came out and told everybody not to drink the water and they actually started delivering water to us. Then they came back and told us that your water is safe to drink. So we started drinking the water.


[User] Please transcribe this text

[Assistant] We just up and left in all the place.


[User] Please transcribe this text

[Assistant] And it was valued at $440,000 and we just walked away from it.


[User] Please transcribe this text

[Assistant] Good morning Chairman Waxman, Mr. Davis, ladies and gentlemen. My name is Steve Mobaldi. My wife Elizabeth and I moved to Rifle Colorado in June of 95 to a 10 acre ranch soon after the oil and gas industry.


[User] Please transcribe this text

[Assistant] Chapter 1 Oliver's Early Life


[User] Please transcribe this text

[Assistant] Oliver Twist was born in a workhouse, and when he arrived in this hard world,


[User] Please transcribe this text

[Assistant] It was very doubtful whether he would live beyond the first three minutes. He lay on a hard little bed and struggled to start breathing.


[User] Please transcribe this text

[Assistant] Oliver fought his first battle without much assistance from the two people present at his birth. One was an old woman who was nearly always drunk


[User] Please transcribe this text

[Assistant] Death was a common event in the workhouse where only the poor and homeless lived. However Oliver managed to draw his first breath.


[User] Please transcribe this text

[Assistant] And then announced his arrival to the rest of the workhouse by crying loudly.


[User] Please transcribe this text

[Assistant] His mother raised her pale young face from the pillow and whispered, Let me see the child and die.


[User] Please transcribe this text

[Assistant] And, uh, yeaah, let's, uh, let's keep going where we left off last time. So, last time we talked about vectors.


[User] Please transcribe this text

[Assistant] How vectors work, uh, we talked about how vectors internally handle, uh, how they handle themselves in memory.


[User] Please transcribe this text

[Assistant] We've talked about the for loop, what a for loop is, what's count, what's capacity, what's the differences between those two.


[User] Please transcribe this text

[Assistant] And we said you can optimize the vector by reserving, uhm, an initial amount of memory upfront.


[User] Please transcribe this text

[Assistant] Rather than data being copied from one memory location to the other.


[User] Please transcribe this text

[Assistant] Uh, binary. Uh, sorry, we didn't talk about binary. Uh, we talked about how decimal numbers work, how hexadecimal number works.


[User] Please transcribe this text

[Assistant] or work and how the memory layout or how memory works essentially uhm.


[User] Please transcribe this text

[Assistant] And all that. We briefly talked about, very briefly, we mentioned, we didn't even talk about it, we mentioned the stack and the heap.


[User] Please transcribe this text

[Assistant] Which we will talk about later on, right? Uhm, but yeaah, we covered all of that. So what I would like to do today


[User] Please transcribe this text

[Assistant] Actually fire a bullet, right? Fire a bunch of bullets. From one location to the other, right? And so we have our vector ready. It's all set up. All I want to do now is actually fire the bullets. Okay.


[User] Please transcribe this text

[Assistant] So before I start with that, I want to...


[User] Please transcribe this text

[Assistant] Uh, explain to you how we can move, uh, an object or a sprite from one location to the other. How can I say? If the player is over here.


[User] Please transcribe this text

[Assistant] And the enemy is over here. How can I move a bullet? From this location.


[User] Please transcribe this text

[Assistant] In this direction. So I move with the first frame here, second frame, third frame here, fourth frame here, fifth, six, seven, eight, nine, right? So I'm moving the bullet from here all the way to here.


[User] Please transcribe this text

[Assistant] How do we do that? How do we say, hey, move in that direction or move in this direction or move in this direction and so on and so forth? Well, it all relates to...


[User] Please transcribe this text

[Assistant] So, let's take a very simple example. Let's say my player is over here.


[User] Please transcribe this text

[Assistant] Right? Let's say my player position currently...


[User] Please transcribe this text

[Assistant] Alright, so this, if this is zero, zero, right? And this is 1920 by 1080. This dot is 1920 by 1080. This dot is zero, zero. Somewhere in the middle of the screen, you can just do a simple division here.


[User] Please transcribe this text

[Assistant] 1920 divided by 2 is 720.


[User] Please transcribe this text

[Assistant] Right, so this dot here has a position of 960 by 40.


[User] Please transcribe this text

[Assistant] Alright, so what if I would like? What if I want?


[User] Please transcribe this text

[Assistant] To move my, my, my character to the right, right? What do I do? Well, this is the X axis, right? And so I increment on the X axis by a specific amount. Let's say by 10.


[User] Please transcribe this text

[Assistant] So every frame, I'm increasing its position on the X axis, and this is the X axis. I'm increasing that by 10. So the first frame, we're at 960. Second frame, we're at 970. And then we move to 980. 990.


[User] Please transcribe this text

[Assistant] Alright, I'm just moving in this direction, on the right, to the right side.


[User] Please transcribe this text

[Assistant] Okay, that's fine. That's all nice and good.


[User] Please transcribe this text

[Assistant] If I want, instead of just moving to the right, let's say I wanna move to this location.


[User] Please transcribe this text

[Assistant] Right? Or yeah, let's move to this location. And so this location is around, I don't know, 1500 pixels on the X axis and maybe 200 pixels on the Y axis or even like a hundred pixels on the Y axis. How can I move in this direction?


[User] Please transcribe this text

[Assistant] Well, the really cool thing is there a formula for that.


[User] Please transcribe this text

[Assistant] Well, my target is over here. I want to go here. This is my target. So that's.


[User] Please transcribe this text

[Assistant] Okay, so this is my target. It's my current location. I would like to subtract the two. Subtract this from this.


[User] Please transcribe this text

[Assistant] Let's subtract these, because we want to subtract the x-axis. This is x, and this is x, so subtract these together.


[User] Please transcribe this text

[Assistant] And this is why, and this is why, so subtract these together.


[User] Please transcribe this text

[Assistant] Okay, so let's do that. What is the tally here? Well, if we get our calculator and say 1500


[User] Please transcribe this text

[Assistant] Right? So this is my direction vector. So look at, look at this direction vector, right?


[User] Please transcribe this text

[Assistant] It says the x axis is positive. So we're moving, we're basically moving. If we start from this dot, we are going to move from here to here 540 units or pixels. So if my starting location is over here, means I'm moving to the right 500.


[User] Please transcribe this text

[Assistant] And then I need to go up and notice this is negative. And remember we said that this is minus y.


[User] Please transcribe this text

[Assistant] And this is positive y. So whenever we're going up, we're going in the negative direction. So now this distance over here.


[User] Please transcribe this text

[Assistant] So the synthesis over here is minus 440. So now we have two vectors, right? We go first to the right, all the way to the right.


[User] Please transcribe this text

[Assistant] So this vector now looks something like this.


[User] Please transcribe this text

[Assistant] A direction of 540 and minus 440. This vector over here. You can completely ignore these two, right? So this vector over here. Okay, the problem with this vector currently


[User] Please transcribe this text

[Assistant] And it makes sense because look at this, I'm going to the right, then I'm going up. All right. If I pick a different location, let's say.


[User] Please transcribe this text

[Assistant] I pick this location over here. This dot. I would like to go to this dot. And this dot location is around, let's say 100 pixels down.


[User] Please transcribe this text

[Assistant] And 50 pixels to, uh, 100 pixels right and 50 pixels down. So this position is 150.


[User] Please transcribe this text

[Assistant] So if we do the math, again, we subtract, this is my current position, right?


[User] Please transcribe this text

[Assistant] So 960, we say, what's the formula? The formula is target minus current, minus current location. So the target is this. So 150.


[User] Please transcribe this text

[Assistant] What's my target? This is my target. What's my current position? This is my current position. 960. And 540. If we subtract these two.


[User] Please transcribe this text

[Assistant] Or minus 860, right? And then subtract these two together. This is minus 490. So notice this, both of these are negative values.


[User] Please transcribe this text

[Assistant] Because when I go to the left, I'm going in the negative direction, right? This is the negative x axis over here. So this vector now, right? This vector over here has a length of minus 80, 860, and then I have to go up


[User] Please transcribe this text

[Assistant] I need to go up 490 pixels. And so now this entire vector over here.


[User] Please transcribe this text

[Assistant] As I go to the left, negative direction, I go up in the negative direction. Right? Okay. The problem.


[User] Please transcribe this text

[Assistant] So now I know this location, like I understand subtracting this location from this location, I know the direction of my vector. My vector needs to go this way. So, the problem here, essentially, is that if this is my location, right? Over here.


[User] Please transcribe this text

[Assistant] That means in order for me to reach this point, I need to first go minus 860 pixels to the left and then minus 490 upwards.


[User] Please transcribe this text

[Assistant] And that gives me that vector. The problem here is that if I just, if I say, this is my position, right? So if I say position.


[User] Please transcribe this text

[Assistant] Right? So what does this do? I'm incrementing my position, my current position here. This is my position. I'm incrementing my current position by this vector.


[User] Please transcribe this text

[Assistant] Which means this, this guy is going to move in this direction to this location.


[User] Please transcribe this text

[Assistant] Right? Which is minus 860 and minus 490.


[User] Please transcribe this text

[Assistant] The problem with that, this is being done in a single frame.


[User] Please transcribe this text

[Assistant] I shouldn't do this in a single frame. I should do it in smaller steps, like small incremental steps. Very tiny, small steps. Okay?


[User] Please transcribe this text

[Assistant] Is do something called normalization. Or I should normalize my vector. Whenever you normalize a vector, you're essentially saying, I would like this vector.


[User] Please transcribe this text

[Assistant] To keep pointing in this direction, so my vector is still going to point in this direction.


[User] Please transcribe this text

[Assistant] However, the length of my vector, how big it is, right, this entire length,


[User] Please transcribe this text

[Assistant] Is much smaller, it's a unit one vector. Meaning that the length is equal to one.


[User] Please transcribe this text

[Assistant] This length currently is not equal to 1, and we'll calculate the length over here.


[User] Please transcribe this text

[Assistant] So when we normalize a vector, we basically take this vector over here and make it a unit one, which means that it points in the same direction, however,


[User] Please transcribe this text

[Assistant] It's now a unit one vector. It's much, much shorter. So imagine this now, rather than moving all in one single frame, right? Rather than just.


[User] Please transcribe this text

[Assistant] Going from this location from the first frame to the second frame going to this location immediately, which would mean I teleported from here to here. Now I'm moving in a smaller incremental steps. I moved by this amount and then I moved by this amount and then I moved by this amount and then I moved by this amount.


[User] Please transcribe this text

[Assistant] That's because I'm now moving incrementally, not just teleporting from one location to the other.


[User] Please transcribe this text

[Assistant] Target minus current location. What is your target? Where would you like to go in the world?


[User] Please transcribe this text

[Assistant] So get that position. That's a vector 2, right? A vector 2. F.


[User] Please transcribe this text

[Assistant] So the target is where I want to go and my current location is also a vector to F and that's where my currently at work. I currently am. So this will give you a direction vector. My direction vector is equal to the target minus my current location.


[User] Please transcribe this text

[Assistant] That's my direction to it. And again, the problem is that it'll give you a big vector, like a big giant vector to go there immediately. I don't want to go there immediately. I want to go incremental steps. So what I have to do is take this entire direction.


[User] Please transcribe this text

[Assistant] Now it becomes a unit one, meaning the length, rather than, for example, let's say this length is ten.


[User] Please transcribe this text

[Assistant] That's the entire idea. So what are we going to do is that we're going to spawn a bullet at this location, at the location of the player.


[User] Please transcribe this text

[Assistant] And then we need to calculate the direction of this bullet. Where is this bullet going?


[User] Please transcribe this text

[Assistant] Once we calculate the direction to the enemy, so the target will be our enemy position. Our current position is the bullet position, and that will give me my direction vector. And like I mentioned, the direction vector is pretty large.


[User] Please transcribe this text

[Assistant] Of, uh, this whole thing, right?


[User] Please transcribe this text

[Assistant] And so we want to start and implement that and work with that, right?


[User] Please transcribe this text

[Assistant] But right now before I jump into that and implement, implement that, I'd like to find out the magnitude of my vector. How long is this vector? So if I look here.


[User] Please transcribe this text

[Assistant] This is my vector, right? So, it's, so if I go here, minus 860, comma, minus 490. Is that correct? 490, yes.


[User] Please transcribe this text

[Assistant] Sorry, I had to sneeze. So I would like to calculate this vector.


[User] Please transcribe this text

[Assistant] How long is it? We know that it points in this direction roughly, because we know that this is pointing to the left.


[User] Please transcribe this text

[Assistant] That's negative. And then I'm going up somewhere. And so that's kind of my direction over here. Okay. This is my direction.


[User] Please transcribe this text

[Assistant] Because I go this many amount to the left and this many amount to the up. Okay. How do I calculate the magnitude?


[User] Please transcribe this text

[Assistant] Well that's really really simple, it's pretty easy, it's not difficult at all. To calculate the magnitude, you have to...


[User] Please transcribe this text

[Assistant] Uhm, yeaah. You basically, in order for you to calculate the magnitude,


[User] Please transcribe this text

[Assistant] You take a, you square it, you take b, you square it, uhm, you add them together and you get the square root. Let's do that.


[User] Please transcribe this text

[Assistant] 860, we're gonna forget them on us. We're gonna, we're gonna, we're gonna pretend these are absolute values.


[User] Please transcribe this text

[Assistant] So these are all absolute values, because, because a vector cannot have a negative magnitude, it only has a positive length, right? So forget about the negative signs.


[User] Please transcribe this text

[Assistant] I think when you square it anyways, it becomes positive if I'm not mistaken. So 860, square at, you get 7, 3, 9, so 7,


[User] Please transcribe this text

[Assistant] Right? So this is the magnitude of my vector. This is how long it is. It is 989 pixels and 79. If I, if I, uh, if I


[User] Please transcribe this text

[Assistant] Let's, let's take the first three digits. Seven nine seven. Seven nine seven nine five nine. Seven nine. Seven nine.


[User] Please transcribe this text

[Assistant] 1815. That can't be any more accurate than this. This is the magnitude of my vector. This is how long my vector is. Right?


[User] Please transcribe this text

[Assistant] Okay, so how do we normalize our vector? Well that's pretty easy. Luckily I remember that part. To normalize your vector,


[User] Please transcribe this text

[Assistant] You take the x axis and the y axis and you divide both the x and y by the magnitude, which is this.


[User] Please transcribe this text

[Assistant] Right. So let's do that. And then you add them together. Obviously let's do that. Right. So in here, kind of this area.


[User] Please transcribe this text

[Assistant] Let's do this. So we basically say 860.


[User] Please transcribe this text

[Assistant] I can't do, right? Something wrong here. I did something wrong with my math, I think.


[User] Please transcribe this text

[Assistant] Okay, I think I did something wrong with my math. I'll check in a second. Uuuh, uh, yeaah, I think I did something wrong. Okay, hold on, we'll see. Let's give me zero point.


[User] Please transcribe this text

[Assistant] The reason I know this is wrong is because if I add this value and add this value, add these two.


[User] Please transcribe this text

[Assistant] No, no, no, I didn't do anything wrong. Okay, so this is the y-axis normalized and this is the x-axis normalized. So now my new values are... Here are my new values. My new values are...


[User] Please transcribe this text

[Assistant] Of how long my vector is, right? Before my vector was 860 and 490. Now my vector is this long.


[User] Please transcribe this text

[Assistant] 418. So that's the x-axis.


[User] Please transcribe this text

[Assistant] Comma, 0.495050, right? So now this is my vector. Before again, before it was 860. Or again, this is all negative value. Minus 860.


[User] Please transcribe this text

[Assistant] And just add the negative sign here. So that's not a big deal. That was, those were my, this is the y axis. Those, how, how, that's how long my vector was before. Now it's this long.


[User] Please transcribe this text

[Assistant] Now, in order for you to check if this is a unit one vector, essentially what you do


[User] Please transcribe this text

[Assistant] Right? You, you found, you found, you find the magnitude. So this is my vector here. And I need to find its magnitude. Right? We found the magnitude of this vector before. Right? We did this operation.


[User] Please transcribe this text

[Assistant] Right? The only reason I need to find this for this vector is just to prove it to you that this is a unit one vector. So these, this number or these two x and y should give me a number one or unit one. Right? So let's try to prove that. So we need to do the same operation here. Essentially square both of these, add them together and get the square root.


[User] Please transcribe this text

[Assistant] Okay, that should be squared root. Uh, not squared root, that should be squared. And squared, you get...


[User] Please transcribe this text

[Assistant] Doesn't matter, it's almost 1. You can see how it's 0.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999


[User] Please transcribe this text

[Assistant] Right? You take those two x and y axes, x and y, square them, add them, get the square root,


[User] Please transcribe this text

[Assistant] Once you do that, you get the magnitude, which in my case is the magnitude. In order for you to normalize this vector, to make it unit one, to make it small, rather than large, what you need to do,


[User] Please transcribe this text

[Assistant] Right? And it makes sense because your vector is this large and has an x and y, nor for you to make it smaller, you just divide by itself, by the length, by its own length. Right? And so now that we've divided its own length,


[User] Please transcribe this text

[Assistant] Right? By the magnitude, we get those two values. And that's it. We could have stopped here. We could have stopped at here and here. This is the normalized vector. My new normalized vector has a


[User] Please transcribe this text

[Assistant] And a unit one vector essentially means is that its magnitude, the magnitude of the vector equals to one. So how do we calculate the magnitude? Well, again, you take those two numbers, square them, right, and get the square root.


[User] Please transcribe this text

[Assistant] So, this is my new vector, right? So now I...


[User] Please transcribe this text

[Assistant] Take this vector, square it. Take this vector, square it. Again, I ignored the minus signs. Take this vector, square it. Take this vector, square it. Uh, add them together and get the square root. And doing that, you saw that this, adding those two, square the game, gets me very close to one.


[User] Please transcribe this text

[Assistant] Alright, it didn't get me to one, and the reason it didn't get me to one is because I lost some data, I didn't take the entire number.


[User] Please transcribe this text

[Assistant] So this is a unit one vector, which means that this vector, you can see it, it still retains its direction. So red direction is saying is that I'm looking to the left. You can see the X axis is negative. I'm looking to the left and then I'm also looking up.


[User] Please transcribe this text

[Assistant] Right, and minus, minus y is up. So minus x and then minus y. And so that would be on my vector over here. Cool?


[User] Please transcribe this text

[Assistant] So that's all we need to do. We need to do all of this, right? So the first thing I would like to do, right? The first thing is subtract.


[User] Please transcribe this text

[Assistant] My direction vector has to be normalized. In order for it to be normalized, I need to find the magnitude. Once I find the magnitude, I divide the X and Y component by its magnitude. When I do that, I finally, I get a normalized vector that I can increment my position by. So now this, this vector, sorry, not this vector, this is not, this vector over here, right? I can say plus equal position. This is my bullet. So I do bullet.


[User] Please transcribe this text

[Assistant] I equal, uh, I add that by minus zero point eight six eight eight, right? Comma minus four


[User] Please transcribe this text

[Assistant] So now I'm incrementing, I'm moving my bullet in this direction in small increments rather than moving it, rather than moving it in larger increments like here, I'm moving it in very large increments pixels. I'm moving them in sub pixels. So very small increments.


[User] Please transcribe this text

[Assistant] You know, yesterday was a very painful day for me.


[User] Please transcribe this text

[Assistant] I, I was trying to grab my phone, and so I grabbed it, but at the same time, I grabbed,


[User] Please transcribe this text

[Assistant] The cable of the mic, because my phone was next to my mic, and so my mic fell, and I tried to catch my mic, well I didn't try to catch my mic, but by pulling the mic, uhm, my phone fell from my hand, which I just picked up, and it smacked


[User] Please transcribe this text

[Assistant] Into the wall. And now my phone has a... My phone is all black, so it has now a silver dent.


[User] Please transcribe this text

[Assistant] On the top left corner of my phone. Which makes me very, very, very sad. I tried coloring it in, in black just to pretend that it's not there. But I don't have any permanent black thing, black marker. And I think it will show off the difference anyways.


[User] Please transcribe this text

[Assistant] And so today I was, I was at a friend's house and I was just walking by and


[User] Please transcribe this text

[Assistant] My watch hits the table and now I scratch my black watch too. So it's just, it's a horrible, it's been horrible two days. Okay. In terms of technology getting fucked. So yay me.


[User] Please transcribe this text

[Assistant] At least I didn't break the screen or anything and the phone functions normally, which is fantastic.


[User] Please transcribe this text

[Assistant] But, you know, it has a, it has a silver dent, which, which I do not like. I like, like to care, to take care of my, uh, tech. Uhm, I don't like them to be smacked. Now, some of you might wonder and ask, why don't you have just, why don't you have a cover like a normal people? You idiot. And,


[User] Please transcribe this text

[Assistant] My answer to that is because covers make your phone look so ugly. Yes, it's, there's a possibility that you're gonna drop your phone, obviously, and damage it, but like, it looks so much nicer without a cover. So I never put covers on. Anyways, I digress. Who cares? Moving on. Okay, cool.


[User] Please transcribe this text

[Assistant] Uhm, so what I wanna do now, I have my vector here, right? So I'm just gonna remove all this good. Okay.


[User] Please transcribe this text

[Assistant] For my std vector string that I just did here. And so what I would like to do is


[User] Please transcribe this text

[Assistant] Well, the first thing I need to do is create a bullet, right? That's the first thing I want to do.


[User] Please transcribe this text

[Assistant] So in the top area, uhm, not in load, right, I'm gonna


[User] Please transcribe this text

[Assistant] I'm gonna do sf, rectangle, shape, and I call this a bullet.


[User] Please transcribe this text

[Assistant] So just single bullet to train on this for now, just a single normal build, bullet. And then my bullet is going to have a constructor, which is going to have a size.


[User] Please transcribe this text

[Assistant] Of, I don't know, 10 pixels by 5 pixels. That's how my bullet is going to be. Right? And so now, I would like to draw my bullet. So window.drawBullet. Okay. So let's see if it draws the bullet correctly.


[User] Please transcribe this text

[Assistant] And you can see my bullet is at the very top left corner. I can make it a little bit more obvious.


[User] Please transcribe this text

[Assistant] By doing one of two things. First, make the fucking ball a little bit bigger. So let's do 50 pixels by 25. And moving it, so sets this position.


[User] Please transcribe this text

[Assistant] Let's have vector 2f. Tell us somewhere else, let's 100 on 100.


[User] Please transcribe this text

[Assistant] Right, or let's do 50 and 50. So I'm moving the pixel, uh, moving the bullet a little bit to the right and a little bit down. Which is over here. This is my bullet, as you can see, it's over here. Alright, so my, now what I would like to do is shoot the bullet or make the bullet move from one location to the other. Right? So I


[User] Please transcribe this text

[Assistant] I want to stay here, right? I want my player to be here. And doing some basic math that basically I would like to


[User] Please transcribe this text

[Assistant] So I know that this is, this here is zero on x-axis, so I want to move all the way here.


[User] Please transcribe this text

[Assistant] So if this point was zero, then this point, and this point is 19.20 by 10.80.


[User] Please transcribe this text

[Assistant] That means this over here is roughly 1000.


[User] Please transcribe this text

[Assistant] 1751x, right, and then if this is zero on y, right, if this is zero on y, and move all the way down here, then this is roughly 900.


[User] Please transcribe this text

[Assistant] Okay, so 1750 by 900, right? So let's just, I'm gonna draw a rectangle around this player, just to compare it, see if I got this right or not. So my player position is gonna be moved.


[User] Please transcribe this text

[Assistant] So his position is going to be...


[User] Please transcribe this text

[Assistant] SF factor 2F. And the play between 1750 and 900.


[User] Please transcribe this text

[Assistant] Notice what I said the position. I said the position when I'm loading the sprites, right? I could have put it anywhere like I could have put it in here, for example. Right, but.


[User] Please transcribe this text

[Assistant] I cannot put it in here, doesn't matter. But the important part that I want you to keep in mind


[User] Please transcribe this text

[Assistant] Is that you only want to set the position once because this is my initial position where my player is initially. I don't want to put it in the while loop because if I put it in the while loop that means that


[User] Please transcribe this text

[Assistant] I'm always setting the position of my player position to 1750 by 900, which means if I try to move it with my keyboard, so I'm going to work. So let me show you an example.


[User] Please transcribe this text

[Assistant] Ah, close. Ah, a little bit far, a little bit far. I need to move it a little bit left, and a little bit up. So, not 1750, maybe 1650. Instead of 900, it's probably like 800. Close. I was, I was very close. There you go. Look at me, I'm so good. Alright, cool. So.


[User] Please transcribe this text

[Assistant] Here's the thing, so my, I've set the initial position of my player here, and I can now move my player, right? I can move him normally like I normally would. However, if I put this, set the position of the player inside the loop, that means every frame I'm setting the position. Which means, if I try to move him using the keyboard, that's not gonna happen. See, I'm pressing my keyboard, I don't know if you can see this, but he moves very slightly. To the right.


[User] Please transcribe this text

[Assistant] And then it stops, because every frame I set the position, if I press the A key, I move him one pixel left, and then I set this position back to where it was. So even if I do 100 here,


[User] Please transcribe this text

[Assistant] So every frame I set his position, I move 100 pixels left, so I'm gonna press A. You can see he moved left, if I let go, he goes back. Because every frame, I'm resetting its position, I'm telling him to put the position here. That's why I only put this, I only set this as initial position, and I only set it once. Right?


[User] Please transcribe this text

[Assistant] Alright, so that means my bullet is also going to be set, will be set around that location.


[User] Please transcribe this text

[Assistant] So my build position is gonna be also over here. Instead of, I'm just gonna do 600 pixels, rather than 650. Which means it'll be a little bit on the left of that layer.


[User] Please transcribe this text

[Assistant] Yeah, that's my bullet. So now what I would like you to, what I would like the bullet to do is move in this direction. Right?


[User] Please transcribe this text

[Assistant] Move in this direction. I want my bullet to go there. Okay, so how do you do this? Again, target, which is my enemy, minus the current position of my bullet. And that's my direction vector. Okay, so let's do that.


[User] Please transcribe this text

[Assistant] Uh, no need to create a function. I can just do it, uh, so I want to calculate the direction only once, right? I don't want to keep calculating the direction over and over and over. So again, I don't put this in the main loop. I put it outside to initialize it. So I'm going to create an area here. You know, calculate.


[User] Please transcribe this text

[Assistant] I can put some code in here. So how do you calculate the action? Again, the first thing you need to do is get the target's position.


[User] Please transcribe this text

[Assistant] So the target position is my enemy. So I'm going to create a vector to F.


[User] Please transcribe this text

[Assistant] Right, call direction equal to enemy or skeleton, I think. Skeleton sprite dot get position.


[User] Please transcribe this text

[Assistant] Get position, right? So subtract both of these, now I have my direction.


[User] Please transcribe this text

[Assistant] Target is the skeleton. My current location is the bullet itself. And a bullet is just my rectangle. My rectangle shape. Right? So now that's my direction.


[User] Please transcribe this text

[Assistant] Now to do that, I have to do it in the while loop in the update because I, I updated every frame. Okay. But notice when I do this, something, something actually is going to happen. Remember we're, we're moving, we're moving my bullet by a really large amount. So we're just going to do it anyways. I'm going to say.


[User] Please transcribe this text

[Assistant] So this just makes me store the bullet position in a variable. It's a little bit easier to work with. I don't have to do that. In fact, I'm not going to do that, but I'm just going to do it for now for a little bit. Uhm, and then I'm going to say bullet.setPosition. I'm going to do bulletPosition.


[User] Please transcribe this text

[Assistant] Okay, so this is just an easier, rather than just


[User] Please transcribe this text

[Assistant] Rather than just typing this inside, right? I can just type this inside and I can ignore this line completely. So I just get the previous bullet position and I add the direction to it. And I set that position, so I'm incrementing that. Uhm, I could do that, right, if I wanted to. It looks a little bit uglier, but it's fine, I can do it, which, which is here.


[User] Please transcribe this text

[Assistant] So now what I'm doing is I, every frame, I get the previous position of my bullet. I add the direction that I would like to move, move in, and then I set that as the position of my, my bullet. The problem here, you're gonna, I'm gonna press play and the bullet is gonna disappear.


[User] Please transcribe this text

[Assistant] Now it's going to move extremely fast. Well, it disappeared. Didn't even move fast. It literally disappeared. The reason for that is that my bullet location is over here, right? It was over here.


[User] Please transcribe this text

[Assistant] And I've basically, what I'm basically saying is that the bullet is going to move. This is the vector of my bullet. This is how long the vector is. And so what I'm saying that every frame, frame number one, move by this amount.


[User] Please transcribe this text

[Assistant] So this is the first frame that's gonna be here. The second frame moved by this amount. So now it's outside the screen. That's in only two frames. Third frame moved by, again, the same amount, right? Now it's way outside the screen.


[User] Please transcribe this text

[Assistant] So rather than doing that, I need to make my bullet, I need to normalize my vector, make it small so it moves in a small increments.


[User] Please transcribe this text

[Assistant] I could do that, which I am going to, but as a hacky way just to make this work, what I'm gonna do is multiply the direction by 0.00 or 0.1f.


[User] Please transcribe this text

[Assistant] So that does, it takes the direction, right, and multiplies 0.01 by, uh, for the X and Y coordinates.


[User] Please transcribe this text

[Assistant] So the x and y coordinates of my direction is going to be multiplied by 0.01, which is going to make that value much smaller. So if I go to my calculator here and I take, what was, what was it? 962 when we calculated this.


[User] Please transcribe this text

[Assistant] So, if I take 860, multiply by 0.01,


[User] Please transcribe this text

[Assistant] Now you can see it's 8.6 pixels. So now instead of moving by 860 pixels every frame, I am moving by 8.6 pixels, right? Just, just, that's just, we're reducing the speed. We're not normalizing the vector. We're just reducing the speed, right? Which is a hacky way of doing it, but it's fine.


[User] Please transcribe this text

[Assistant] So here you can see the bullets moved, but moved way too fast, so I have to do 0.001. Now it's gonna be even slower.


[User] Please transcribe this text

[Assistant] Alright, you can see that. It's still too fast. I need to reduce that even more.


[User] Please transcribe this text

[Assistant] There you go. You can see now my bullet is moving in that direction because that's where my enemy is. Okay. What if I drop down the enemy? What if I put the enemy a little bit down? So if I go to the skeleton.


[User] Please transcribe this text

[Assistant] And I set this position instead of 100, let's say 700.


[User] Please transcribe this text

[Assistant] So now he drops way down. So now look at the bullets, what it's going to do. Now the bullets.


[User] Please transcribe this text

[Assistant] It's gonna move in his direction. It's no longer moving up here because the enemy...


[User] Please transcribe this text

[Assistant] And if I move, uhm, if I move the, the enemy to the right, let's say...


[User] Please transcribe this text

[Assistant] Let's say I move my skeleton, the enemy skeleton to the right, all the way to the right. So let's do, let's do 1200. Right? And I, I'm gonna put the player at 0, 0. Let's have 1000, maybe 1000.


[User] Please transcribe this text

[Assistant] You know what? I'm just gonna set the bold position to the player position. Right? It doesn't matter. So now this code, this here, right? I'm gonna move this line of code because I cannot just type here, uh, player, or is it, is it player? Yea, player sprite. I can't do player sprite dot get position. I can't do that in here.


[User] Please transcribe this text

[Assistant] Right? Because player sprite, I still haven't initialized it. Right? There's no player sprite up here. The player sprite is way down here.


[User] Please transcribe this text

[Assistant] You can see the player's part here. So I need to move this line from the top to kind of the bottom to make this work. So I need to move it here before the direction.


[User] Please transcribe this text

[Assistant] So now here what I'm saying, just set the bullet, set the bullet position to the player position, wherever the player is. Alright, so now if I press play, you can see the bullet is gonna move from the player, right?


[User] Please transcribe this text

[Assistant] To the enemy, which is this enemy, and this is my player over here, like I'm moving in the player, right? But the bullet moves towards the enemy.


[User] Please transcribe this text

[Assistant] Right? We did it in a hacky way where we multiplied by very small values to normalize it.


[User] Please transcribe this text

[Assistant] Let's actually normalize it. As far as I know, uhm, SFML doesn't have a normalization, yeaah, they don't have, so sf vector to f dot or x.


[User] Please transcribe this text

[Assistant] X dot, yeaah, they don't have a normalized function. So we have to make our normalized function. And that can be done really easily. It's not that difficult. So at the very top, I'm going to create, I'm going to say void norm,


[User] Please transcribe this text

[Assistant] As vector. Right? This will take an SF vector to F.


[User] Please transcribe this text

[Assistant] Okay, so how do you normalize a vector? Let's look at this formula.


[User] Please transcribe this text

[Assistant] Take the x, y components, uh, square them, and then get the square root. So, vector.x plus vector.y.


[User] Please transcribe this text

[Assistant] Right? Now to square something, there's a cool trick rather than just doing square, it's basically multiplying it by itself. So if I take vector x, multiply it by itself, that's the same thing as square. And so if I take this and multiply it by itself, it's the same thing as square. And look, the multiplication will happen before the addition, because


[User] Please transcribe this text

[Assistant] A library, a standard math library called CMath. Or math? Is it math or CMath?


[User] Please transcribe this text

[Assistant] C math is for C. This is just math. Okay. So now I can do, I can do SCD. Square.


[User] Please transcribe this text

[Assistant] Uh, square root, right? And square root will take a double as an input. So what I can do is just take this, put it all in here.


[User] Please transcribe this text

[Assistant] Okay, so that's gonna give me the magnitude. So I'm gonna do float, m equal to this. So that's my magnitude, right? Uhm.


[User] Please transcribe this text

[Assistant] Okay, so square root takes a float. This is the float. It's going to return a float, which is my magnitude. Now all I have to do is do


[User] Please transcribe this text

[Assistant] Or, I'm gonna make a variable here, sfVector2.


[User] Please transcribe this text

[Assistant] So we get the magnitude and we get that by multiplying the x components, multiplying the y components by each other or squaring them, adding all of this, getting the square root. That's my magnitude.


[User] Please transcribe this text

[Assistant] Now I create a new variable called normalized vector. This is going to be my normalized vector. My normalized vector is going to be equal to vector.x, which is this one, the one that we just came in.


[User] Please transcribe this text

[Assistant] Subtracted, uh, not subtracted. Divided by the magnitude, right? Just like here.


[User] Please transcribe this text

[Assistant] So we did this part, we added this part, and we got the magnitude. Now this part, where we take 860 and divide it by the magnitude.


[User] Please transcribe this text

[Assistant] So, this is the vector that I want to normalize. I divide the x component by its magnitude. And the vector that I want to normalize, I divide it by its own magnitude. Once I divide both of these, I store them in a new vector called the normalized x and y vector. Now I would like to return


[User] Please transcribe this text

[Assistant] The normalized vector. So it means that this has to be SF, vector to F. So now this function returns a vector to F, which means that this is now normalized.


[User] Please transcribe this text

[Assistant] Alright, this is a normalized. So if I put a vector in here.


[User] Please transcribe this text

[Assistant] Whatever vector here, I'm going to do all this math operation on it, right? Normalize it and return the normalized value, which is super cool. So let's normalize my direction. So now in here, I'm just going to do direction equal to normalize vector. And I pass in the direction again. So the direction will be passed into this function.


[User] Please transcribe this text

[Assistant] It will go through all this math and then we're going to return the new vector, the new direction vector, which will be stored back inside direction. So now the action is now normalized, right?


[User] Please transcribe this text

[Assistant] I put in the unnormalized direction over here. I put it inside here. And then the output will be the normalized vector, uh, for normalized direction. So I don't have to multiply by this hacky number, right? Because if I press play,


[User] Please transcribe this text

[Assistant] It's going to be slow because now this is a normalized vector.


[User] Please transcribe this text

[Assistant] You can see it's still a bit fast, but it's nowhere like before. Now it's normalized. My vector is normalized.


[User] Please transcribe this text

[Assistant] So now I can control the speed of my bullet by multiplying the direction by speed. I'm going to call this bullet speed and I'm going to call this bullet direction. So bullet direction.


[User] Please transcribe this text

[Assistant] Both direction, both direction, right? Then both speed. We need to create this variable. So I'm going to create it at the top.


[User] Please transcribe this text

[Assistant] Uh, over here, so float, bolt speed equal to five.


[User] Please transcribe this text

[Assistant] Or I can just do 5 points. 5 on 0F.


[User] Please transcribe this text

[Assistant] It doesn't matter what you do it, how you do it, but it's fine. But now my bullet speed is faster, right? So now it's going to move much, much faster. So now look at what I'm doing. I'm taking the previous bullet position and I'm adding to it the direction multiplied by the bullet speed. So I can control the bullet speed up and down.


[User] Please transcribe this text

[Assistant] Faster and slower, depending on what I want. You can see now the bullet speed is much faster. And if I think that's way too fast, I can reduce that. So now instead of 5, I can do 0.5f. So now it's half the speed.


[User] Please transcribe this text

[Assistant] But now this is not hacky way. This is not the hacky way because remember before we had to multiply by 0.000 like one, like a very small value. Now this is just the normal speed of my bullet. I normalize my vector and I multiply by the speed of my bullet. Now my bullet is moving in that direction, which is great. It's fantastic. All right, cool. We've done all of that and my bullet is moving in that direction.


[User] Please transcribe this text

[Assistant] So instead of creating a signal variable, now we need to create a vector or a list of variables or a list of bullets. All right, that can be easily done. So what I'm going to do here, I'm going to say SF, not SF, sorry, STD, vector, right? And this is going to be a type rectangle shape called bullets.


[User] Please transcribe this text

[Assistant] So notice I've created a vector of type


[User] Please transcribe this text

[Assistant] I can comment this, these two lines. I'm going to keep the world speed. I like the world speed.


[User] Please transcribe this text

[Assistant] Uh, but I'm gonna comment this line code out, because I don't want to create a bullet anymore. Now it's bullets. Okay. Now, the direction.


[User] Please transcribe this text

[Assistant] Or we wanna set the bullet speed, right? We wanna set the bullet, so we'll do that later again. And we'll just comment all this, literally. Any code that's related to the bullets, we'll just comment it all out, because we wanna start a little bit fresh.


[User] Please transcribe this text

[Assistant] Okay, so all I have here, even the rendering part, comment all that out. So all I have here right now.


[User] Please transcribe this text

[Assistant] IsButtonPressed, right? And I do SF, mouse, button.


[User] Please transcribe this text

[Assistant] Left button. So if I press the left button with my mouse, I would like to fire a bullet. So bullets. Pushback.


[User] Please transcribe this text

[Assistant] The rectangle shape is going to be, if I remember, this is the size of my bullet.


[User] Please transcribe this text

[Assistant] So let's look at this line of code. Whenever I press the left mouse button, right?


[User] Please transcribe this text

[Assistant] I go, I go to my bullets variable. This is my bullets variable.


[User] Please transcribe this text

[Assistant] In my bullets variable, I add a new element to this list, or to this vector. Let's call it a list. This list, I'm adding a new bullet.


[User] Please transcribe this text

[Assistant] The top of the bullet is a SF rectangle shape because the vector here we created is an SF rectangle shape. Right? So, I am pushing.


[User] Please transcribe this text

[Assistant] A new or a new SF rectangle shape with the size of this rectangle shape of this size. Right? And so.


[User] Please transcribe this text

[Assistant] There you go. If you want this to look a little bit nicer, maybe, maybe this entire line is a little bit too confusing.


[User] Please transcribe this text

[Assistant] Split it down into multiple parts. You can say SF rectangle shape. New. Bullet. Right.


[User] Please transcribe this text

[Assistant] And you give the size of the bullet, and you're inserting just a new bullet.


[User] Please transcribe this text

[Assistant] So saying bullets to push back new bullet, which is this, which has a size of that, whoops, which has a size of that. So this is my new bullet, a rectangle shape with a specific size. And I just push back a new bullet, right? You could do that, but there's no need for making it two, two lines. We'll just do it in a single line.


[User] Please transcribe this text

[Assistant] All right. Now that we've added a bullet, right? We've pushed a bullet here. Now I need to do what I was doing before. So I've pushed out a new bullet. I can delete this line of code. What else I was doing? Well, if I scroll down.


[User] Please transcribe this text

[Assistant] I was setting the bullet position, you can see here bullet.


[User] Please transcribe this text

[Assistant] Now I need to get the, the last bullet in this list. To get the last bullet, I do bullets, open the, these brackets, they're called array brackets or square brackets, bullets that size minus one.


[User] Please transcribe this text

[Assistant] Why, why did I do bullets.size minus one? Remember last lecture, we talked about this. We said if I want to get the last element.


[User] Please transcribe this text

[Assistant] Right, the last element that I just added in here, I get the size minus one.


[User] Please transcribe this text

[Assistant] Right? So this is my list of my bullets. If I add three bullets, one, two, three.


[User] Please transcribe this text

[Assistant] Right. If I do bullets dot size, that'll give me the value three. So it tells me the three bullets in here. Right. And what we want is the index.


[User] Please transcribe this text

[Assistant] Right? I want the index of my bullet so I can access the last element. And to get the index is n-1, so 3-1. Right?


[User] Please transcribe this text

[Assistant] And I, I get to, which is the index of the last element. So same thing here. I push a new bullet over here.


[User] Please transcribe this text

[Assistant] Right? To get, I, and now, now that I pushed a new bullet, I wanna get access to that bullet, I wanna set its position, I wanna manipulate that element that I just added to this list.


[User] Please transcribe this text

[Assistant] So I need to access that element. To do that, I go to my bullets list, right? And I find the last bullet. And to find the last bullet, the index of the last bullet, I just say bullets.size, right? Which will become one. Before, like, if I delete those two lines,


[User] Please transcribe this text

[Assistant] The bullet size is zero because I haven't added a bullet, but at this line I did push one bullet. So when I say a bullet that size, this is going to return a value of one.


[User] Please transcribe this text

[Assistant] So one minus one is zero. So the last element that I just added has an index of zero because there's only right now one bullet. If I added the second bullet, then


[User] Please transcribe this text

[Assistant] Then bullet.size is going to be two because now I have two bullets. So I want to access the last element, right?


[User] Please transcribe this text

[Assistant] Right. And if you want this to look a little bit nicer, maybe a little bit too confusing, you can do int index or last element equal to


[User] Please transcribe this text

[Assistant] Bullet, bullet.size, minus one, and you can just access the last element right here.


[User] Please transcribe this text

[Assistant] So now I'm saying bullets, square brackets, last element, which will be however it is, 0, 1, 2, 3, whatever the last element is, and I set the position of my bullets in the last element. So the last, the thing that I just spawned essentially, when I click, whatever I just spawned, I need to set its position to the player position.


[User] Please transcribe this text

[Assistant] That's my entire goal. And I want to only do it for the last element because that's the bullet that I just spawned. Right?


[User] Please transcribe this text

[Assistant] So you can do it this way. I'm going to go back to the way it was because it's a little bit nicer. Actually, I'm going to do this multiple times. So maybe yes. Instead of last element, I'm just going to do i because i is famous for being kind of the thing you want to access, the element you want to access. Okay. So I set the position, right? What else do we do?


[User] Please transcribe this text

[Assistant] Well, we need to calculate the direction. So let's copy these two lines of code and paste them here.


[User] Please transcribe this text

[Assistant] So I don't, I don't need this line because this is just takes the bullets at its position to the player position. We've already done that here, so I can remove this line.


[User] Please transcribe this text

[Assistant] And so, this line basically gets me the bullet direction. Is the enemy, and I want to get the bullet position. And again, to get the bullet position, the last bullet that I just spawned, I do just bullet eye. Bullets eye.get position. So it's my bullet direction. And now, I want to normalize that direction, which I do. So now I have a bullet direction, which is normalized. Right? Okay. So what I want to do now,


[User] Please transcribe this text

[Assistant] Now I would like to move that bullet in that specific direction. Right?


[User] Please transcribe this text

[Assistant] Now, here's what I just realized while writing this code and kind of explaining all this to you.


[User] Please transcribe this text

[Assistant] We have multiple bullets, or we're gonna spawn multiple bullets by pressing the left mouse button.


[User] Please transcribe this text

[Assistant] And the problem here is that we have a single direction variable that holds a single direction for my bullet.


[User] Please transcribe this text

[Assistant] Single direction, which means all the bullets will always, always have the same direction no matter what.


[User] Please transcribe this text

[Assistant] Now sometimes that's not true. Sometimes I want like the bullets to have different direction.


[User] Please transcribe this text

[Assistant] If I want to, that's a possibility, but currently with the code we've written, all the bullets will have the same exact direction, which is not good. Okay. So we can solve that later on, but for now it's fine. It's not the end of the world.


[User] Please transcribe this text

[Assistant] Okay, so I would like to move my, now all my bullets. Well, before I move my bullets, I would like to draw all of them. So let's draw all of them. So drawing happens here. Okay, how do we draw a vector of bullets? This here. Well, I can just say,


[User] Please transcribe this text

[Assistant] When do I draw bullets? Because bullets is a vector, is an STD vector, right?


[User] Please transcribe this text

[Assistant] I can only draw a single element, which is a rectangle shape. I can draw a rectangle shape. So for example, if I say I would like to draw the first element, I can do that.


[User] Please transcribe this text

[Assistant] Or the second element I can do that, or the third element I can do that. But I wanna draw all the elements, so how can we do that? Well, a for loop.


[User] Please transcribe this text

[Assistant] So now, after I draw the skeleton in the player, I loop through all the bullets, and I draw every single bullet individually. So I go here, draw a bullet, and then go here, draw a bullet, draw a bullet. When I'm done with drawing all the bullets, I can display everything on the screen.


[User] Please transcribe this text

[Assistant] So we're done with the bullets, drawing them, how about now we move them?


[User] Please transcribe this text

[Assistant] I can't move the bullets inside this if statement because this, this code only executes if I press the mouse button.


[User] Please transcribe this text

[Assistant] But I want to keep moving my bullets, even if I stop pressing the mass button. So that means that this code has to be out here. Okay. So again, we need another for loop for all my bullets. And now I would like to


[User] Please transcribe this text

[Assistant] How do we move something? Well, remember we do player sprite.setPosition.


[User] Please transcribe this text

[Assistant] We get its position, we move by a certain direction. We already have the direction calculated here, and we already know the bullet's position, initial position, so we can just move it. So if I copy this line and modify it a little bit, instead of player sprites, this now is gonna be bullet's eye.


[User] Please transcribe this text

[Assistant] To access every single individual element, every bullet in the bullets list, we're going to set their position, right? Their position is going to be, well, the bullet position. So, dot get position. I want to get the bullet position.


[User] Please transcribe this text

[Assistant] Plus, I need to move it in a specific direction, which is going to be bullet direction multiplied by bullet speed.


[User] Please transcribe this text

[Assistant] There's an error for bullet direction. And if you read the error, it says identifier bullet direction is undefined, which means that it cannot find this variable. But how come we created the variable? Try over here. Like this is literally the variable. How can it not find it? Well, remember we talked about scopes.


[User] Please transcribe this text

[Assistant] We said that everything has a scope, so this F statement has this scope.


[User] Please transcribe this text

[Assistant] And everything lives on this line or created on this line and it dies on this line. So that means that I'm creating this variable over here. So it only exists in the scope. It cannot exist outside the scope.


[User] Please transcribe this text

[Assistant] Okay, well how can we make this bullets variable exist outside the f statement?


[User] Please transcribe this text

[Assistant] Well, rather than creating the variable in here, we created somewhere else. So you can see here I'm creating it and the way I created this by just saying SF vector to I bullet direction. So only this part, the part that I highlighted here. So this part is the creation part. I created the bullet here.


[User] Please transcribe this text

[Assistant] So rather than creating a NIF statement, she created somewhere else, which is going to be, um, let's say here outside the loop.


[User] Please transcribe this text

[Assistant] And the reason I picked out the loop is because if I create it inside the loop, that means that the direction is going to be reset every single frame, which I don't want to. I don't want to reset the direction every frame. I don't want to.


[User] Please transcribe this text

[Assistant] I wanna set it back to zero every single frame because


[User] Please transcribe this text

[Assistant] If I do that, I basically create the direction on this line.


[User] Please transcribe this text

[Assistant] So I created it up here, now I can just use it. I don't have to create it again here. So I can just delete this and I can just use it, right? And my error is now gone, right? But my point is, if I create the bullet,


[User] Please transcribe this text

[Assistant] And then I'm gonna do- go down, go down, do all of this code, go all of this code.


[User] Please transcribe this text

[Assistant] Calculate the direction, move by certain direction, right? And then...


[User] Please transcribe this text

[Assistant] We're going to go here and then I'm going to restart the loop to go to the second frame. The second frame, I reset my direction back to zero, right? At the very end of my loop, this is where my loop ends. When I, when my loop ends, I destroy all variables that I just created inside this loop. So look at this line, this dotted line.


[User] Please transcribe this text

[Assistant] Let's follow the dotted line. The dotted line goes all the way over here. So it means I created this variable.


[User] Please transcribe this text

[Assistant] In this loop, which means at the end of the loop, this variable will be destroyed. However, if I move this variable outside the loop, then this variable will only be destroyed if this scope ends, the main scope ends. So where's the main scope? Here's the main scope. You can see this is the main scope.


[User] Please transcribe this text

[Assistant] Let's follow this line. Main scope, main scope, main scope.


[User] Please transcribe this text

[Assistant] You can see that the bullet direction is in the main scope, so it will only be destroyed when the main scope is over. And the main scope is only over when we exit the game, because we are forever stuck in the main loop.


[User] Please transcribe this text

[Assistant] Right? And so, I would, there isn't nothing, there's nothing wrong with putting the variable here by the way. Right? Just the only, the only issue is that I'm creating the variable, I'm setting its value,


[User] Please transcribe this text

[Assistant] I'm calculating this value over here, and then I'm destroying it. Right? The problem that we're gonna find...


[User] Please transcribe this text

[Assistant] Is that, actually, we are going to have a problem. The problem that we're going to find is that, if I'm not, if I stop pressing the left mouse button, my bullet direction is not going to be recalculated.


[User] Please transcribe this text

[Assistant] So if I destroy, if I create it over here and I destroy it later on, the direction data will always be gone. This math calculation is always gone because we destroyed the variable at the end of the loop and we recreated it again without doing the math again because we only do the math if we press the math button.


[User] Please transcribe this text

[Assistant] And so now we're moving the bullet in a completely wrong direction. And I can prove that to you. So if I press play, right, and if I click my mass button, I'm going to click and hold my mass button. I'm holding. You can see those are all my bullets. If I stop holding, the bullets all stop moving.


[User] Please transcribe this text

[Assistant] Because the direction is reset, right? Direction is just, well, reset. It's destroyed. Reset is zero.


[User] Please transcribe this text

[Assistant] Right? So it's important that you know where you're putting your variables in the loop. If you create a variable in the loop, it's going to be destroyed in the loop, every single frame. So first frame, it exists. Second frame is not going to be, it's not going to exist.


[User] Please transcribe this text

[Assistant] So that's why I create my variables outside the loop, just like how to create this variables outside the loop, because I don't want them to reset. I want to, I want them to store that data until the end of the program, which is very important.


[User] Please transcribe this text

[Assistant] So bolt speed, bolt action and bolt, and bolt last.


[User] Please transcribe this text

[Assistant] Is all up here, right? Then I can delete this lot of code.


[User] Please transcribe this text

[Assistant] Right? So let's do a quick review. When I click my mouse button, I push a new bullet with a specific size. I get the last bullet that I just added.


[User] Please transcribe this text

[Assistant] I set the position of the last bullet to the player position. I calculate the bullet direction, and I normalize the bullet direction.


[User] Please transcribe this text

[Assistant] Every frame I loop through all my bullets and I move my bullets by, by taking its previous position and adding to it the direction by speed.


[User] Please transcribe this text

[Assistant] Which means that the bullet is gonna move in a certain direction.


[User] Please transcribe this text

[Assistant] With a certain speed from its previous position or known position for every single bullet.


[User] Please transcribe this text

[Assistant] I have multiple bullets, which is kinda cool. If I move the player, you can see the bullets spawn for the players. Alright, I'm spawning the bullets.


[User] Please transcribe this text

[Assistant] Where the player is, and all the bullets loaders, all the bullets are going towards the enemy. All of them are going towards the enemy.


[User] Please transcribe this text

[Assistant] But they're not going in the correct direction, because here's the thing.


[User] Please transcribe this text

[Assistant] All the, you can see there are some errors, so if I, if I move here.


[User] Please transcribe this text

[Assistant] I go down while, while this, this bullet is now still moving straight. It's not moving in this direction. It should be moving in this direction. So what's going on? Well, because the bullet at the top, the direction of the boat as the top changed according to the last bullet that I added, because again, that doesn't make quite a lot of sense.


[User] Please transcribe this text

[Assistant] The reason it's a little bit messed up is because again, we only have a bullet direction, one variable for all the bullets. So if this bullet direction changes for some other bullet, that means all of the bullets direction will also change. So how can we solve that? Well, rather than calculating the direction only once,


[User] Please transcribe this text

[Assistant] Because I only calculate the direction once when I click the mouse button. So rather than doing it once, I do it every single frame.


[User] Please transcribe this text

[Assistant] So now, every loop, so if I press, when I press the mouse button, I add a new bullet, I get the last bullet, and I set its own position to the...


[User] Please transcribe this text

[Assistant] And I subtract from it, you know, I get the skeleton, this is the target, minus the player position, or minus the bullet position.


[User] Please transcribe this text

[Assistant] The target, minus the current position, that's the direction. I normalize my direction and I move the bullet in that direction. So I use that every frame rather than doing it only once. So now I really don't care if I destroy this bullet variable. So you see.


[User] Please transcribe this text

[Assistant] This bullet direction, I don't care now. I can just put it in here. I can just do this. Now I'm creating the bullet direction.


[User] Please transcribe this text

[Assistant] And I'm destroying it at the end of the for loop. And I really don't care, because I did the math.


[User] Please transcribe this text

[Assistant] I moved the bullet in that direction and I'm done. Now I can recalculate it again. So I don't care about, I don't want to keep this bullet direction forever. I just want it to do the calculation and set its position or set its direction over here. Right? So now if I press play.


[User] Please transcribe this text

[Assistant] I shoot the bullet, now all the bullets will always...


[User] Please transcribe this text

[Assistant] No matter where I am on the screen, they will always move in this direction. You see? Now they're merging. All the bullets are merging to go to this point. Right?


[User] Please transcribe this text

[Assistant] They all go to this point, which is the top left corner of the enemy, which is where it is right now.


[User] Please transcribe this text

[Assistant] Now, let me, I feel like I didn't explain this very well, right? So let me try to reiterate on this point.


[User] Please transcribe this text

[Assistant] I add a new bullet, I get the last bullet, I set its position to the player position. I calculate the bullet direction, and I normalize my bullet.


[User] Please transcribe this text

[Assistant] That only happens once when I click my mask button. Okay, only once. Now every frame.


[User] Please transcribe this text

[Assistant] Whether I clicked my mouse or not, every frame, I update the bullets position.


[User] Please transcribe this text

[Assistant] The build position is I get their last position and I move them in a specific direction, which I calculated and I stored here. Why is this a problem? It's because let's say,


[User] Please transcribe this text

[Assistant] My player shot a bullet over here. So now I'm the enemy here. So now I know that the bullet should go in this direction, right? But then I moved down.


[User] Please transcribe this text

[Assistant] Right? Now, I shot a bullet. So now, those both bullets, both of these bullets share the same direction variable. And before, the direction was saying go down here.


[User] Please transcribe this text

[Assistant] Now the direction of this bullet says no, go down there. So now it's more steep.


[User] Please transcribe this text

[Assistant] If I, if I move all the way over here and I spawn a bullet here,


[User] Please transcribe this text

[Assistant] Right? So now, the direction of this bullet...


[User] Please transcribe this text

[Assistant] So now we've changed where this direction variable is pointing to.


[User] Please transcribe this text

[Assistant] So, all bullets share the same direction variable. So this is the same direction variable. The first bullet says, go here.


[User] Please transcribe this text

[Assistant] So now it's slowly moving there, slowly not yet, but the player went down, right? And he's pawned the bolt over here. So now.


[User] Please transcribe this text

[Assistant] Both of these guys are using the same variables, but because this is the last bullet that I spawned, it override, it overread what the, the bullet or what the direction of the bullet is. So now the new direction is more something like this.


[User] Please transcribe this text

[Assistant] So it's less steeper. So now, both bullets are gonna move, right? Both bullets are gonna move in that direction. But this is not the correct direction because now,


[User] Please transcribe this text

[Assistant] It's a little bit less steep rather than it's being like this, it's now less steep. So now it's actually getting a correct course and kind of move in this direction. So it's going to miss the player altogether, the enemy altogether. So if the player is now over here.


[User] Please transcribe this text

[Assistant] So now this is the last bullet that I shot, and you can see that this bullet, in order for it to get to the enemy, it can just move in a straight line. So now,


[User] Please transcribe this text

[Assistant] Let's say these two bullets are now over here. Their position is now over here. And where before they were taking this direction.


[User] Please transcribe this text

[Assistant] Now, they're all taking the latest direction, which is straight. So now these bullets now move in this direction.


[User] Please transcribe this text

[Assistant] That's why all bullets, it's bad to have all bullets share the same direction. Each bullet should have its own unique direction. And that was the problem.


[User] Please transcribe this text

[Assistant] All of these, all these bullets are sharing this single variable which is created at the very top of my class or at the very top of my program. Right? So how did I fix that? How did I change that? Well, before I only calculated the direction with my mouse click.


[User] Please transcribe this text

[Assistant] So rather than doing that, now what I can do is calculate the direction every single frame.


[User] Please transcribe this text

[Assistant] When I update the bullet position. So before I update the bullet position, what I do is create the bullet direction.


[User] Please transcribe this text

[Assistant] Figure out the direction. Normalize direction, move the bullet in that direction, and then move to the second bullet. The second bullet...


[User] Please transcribe this text

[Assistant] We'll have a completely different direction because it has a completely different position. The bullet spawns somewhere else.


[User] Please transcribe this text

[Assistant] Right? So now because rather than each single bullet having, sharing the same direction, right? If I spawn a bullet,


[User] Please transcribe this text

[Assistant] Right, the box is over here, and now I know it needs to move over there. Right? And maybe it moved a little bit, let's say it moved over here.


[User] Please transcribe this text

[Assistant] Right? There was a time period, right? Like 5-10 frames went by and the bullet now moved over here. And then I spotted a bullet over here. Now this bullet knows it should go over there.


[User] Please transcribe this text

[Assistant] And then I go maybe over here and I spawn a bullet and maybe those go over there. So now.


[User] Please transcribe this text

[Assistant] All of these bullets, they have different direction variables. I recalculate the direction. I basically go here, check.


[User] Please transcribe this text

[Assistant] What's your position? This is your position. I do the math. T minus C. Alright, okay. And I get the direction. Normalize it. Now I calculate the direction for this. And then I recalculate the direction for this. And then I recalculate the direction for this. Where before, I only calculated the direction once. And only once when I clicked the math button. Which means...


[User] Please transcribe this text

[Assistant] That now all of them share the same direction, so now if it's all of a sudden a direction goes right, then all of them will go right. Where now, rather than all of them having the same direction,


[User] Please transcribe this text

[Assistant] Or the same variable. I recalculate, I redo this math every single time. Before I move the bullet, I calculate the direction. Which is not the most ideal thing.


[User] Please transcribe this text

[Assistant] In the world, right? But it makes sense because later on, if the enemy moves somewhere, I want the bullet to follow the enemy. I could, like, that's something maybe I want to do that.


[User] Please transcribe this text

[Assistant] If not, then that means I need to calculate the direction for every single bullet once, and I need to store it in a variable so it's only calculated once, I don't need to do it over and over and over again.


[User] Please transcribe this text

[Assistant] I hope this made sense. I don't know if it did. Uh, I feel like I talked too fast. I glossed over some things. I didn't gloss over anything, but uh, maybe I didn't explain it too well. The entire point that I want to get to is now.


[User] Please transcribe this text

[Assistant] For every bullet, in this specific frame, for every bullet, I calculate its direction.


[User] Please transcribe this text

[Assistant] Where before I only calculated the direction for all, where before I calculated the direction for just the last bullet that I shoot.


[User] Please transcribe this text

[Assistant] And all the bullets used that direction, that same direction. So all of them use the same direction. Where now I calculate the direction for every single bullet individually. That means the bullet will follow the enemy if the enemy moves somewhere. Which we can fix that if we don't want that behavior. Right?


[User] Please transcribe this text

[Assistant] But there you go, the point is now I can shoot, and all my bullets will always go to the enemy, no matter where I am.


[User] Please transcribe this text

[Assistant] No matter who I am, all my bullets are going to the end.


[User] Please transcribe this text

[Assistant] Hope that made sense. Now, here's the thing though. Here's the problem that I have.


[User] Please transcribe this text

[Assistant] See how disgusting this code? Right now we're at 132 lines of code. And this is really bad. We've written literally all this code in one source file. This is really not great. Especially if this is gonna be like a big RPG game. Like we barely have anything. What do we have? We have a player and an enemy.


[User] Please transcribe this text

[Assistant] And we're shooting bullets and this code looks so messy already.


[User] Please transcribe this text

[Assistant] I can't, you can't imagine creating a whole game on one single source file. That's really bad. So what I want to do next lecture.


[User] Please transcribe this text

[Assistant] Is rewrite this code and split it into multiple classes.


[User] Please transcribe this text

[Assistant] Right? Uhm, or multiple files. And it'll be much, much nicer and much, much cleaner. Yeaah, that's the entire idea. Right?


[User] Please transcribe this text

[Assistant] Alright, I'm gonna end off here for now. This is, that's gonna be it. Bullets.


[User] Please transcribe this text

[Assistant] Uhm, what I would like you, what I would like to do now, uh, you can, you can just turn off, like, you can turn off the stream right now, and be like, okay, thank you, done, if you understood this. If you didn't understand it, I wanna go over this one more time, because I feel like I can explain this a little bit better. Okay, so, if you're good to go,


[User] Please transcribe this text

[Assistant] Thank you for watching. I'll see you next lecture. If not, I'm just going to explain this a little bit more.


[User] Please transcribe this text

[Assistant] The whole bullet direction thing, because I feel like it's not quite there yet. Okay, so.


[User] Please transcribe this text

[Assistant] I'm getting controls a little bit of code. Gonna show you again the old way of doing things.


[User] Please transcribe this text

[Assistant] Okay, let's, let's look at this code. What I'm, what am I doing here? At the very top. I'm taking a bullet. I'm creating a bullet direction.


[User] Please transcribe this text

[Assistant] This is a variable that I create. I create it in the main function.


[User] Please transcribe this text

[Assistant] So that means this variable will only be destroyed at the end of the program.


[User] Please transcribe this text

[Assistant] Because the scope of this variable is in the main function and the main function is all, is, is the main function scope is done when I return zero over here. Right?


[User] Please transcribe this text

[Assistant] So any variables you create in the main function will only be destroyed when the program exited.


[User] Please transcribe this text

[Assistant] So same thing with skeleton texture, skeleton sprite, bullet, direction. All these guys, all these variables will only be destroyed when the program is destroyed. Alright, so I have a single variable over here called bullet direction. What am I doing here? Every time I press my mouse button, I push a new bullet. I get the last bullet. I set its position to the player position. Okay.


[User] Please transcribe this text

[Assistant] So this over here, I make, I create the bullet over here. Now I set this position here. When I click my mouse button.


[User] Please transcribe this text

[Assistant] Okay, click my mouse button, added the bullet, got the last bullet that I added, and I set the position to the player where the player is. In this case, the player is over here. Okay, create the bullet over here. Next, I need to calculate the direction between this bullet and the target.


[User] Please transcribe this text

[Assistant] Which is the skeleton. So target minus my bullet position, that's my bullet direction. So this bullet direction, this variable, which existed at the very start of my program has now the value of the direction of this bullet, which is


[User] Please transcribe this text

[Assistant] It's a much smaller vector, so now it moves in intervals, right?


[User] Please transcribe this text

[Assistant] That's not really that important. Anyways. So now this bullet has this direction.


[User] Please transcribe this text

[Assistant] Okay. I haven't, and then I only pressed it once. I didn't press again. I didn't press to add another bullet. So now I loop through all the bullets, which are just currently one bullet. I move the bullet, right? I move all the bullets. I move the first bullet. I get this position, this position, right?


[User] Please transcribe this text

[Assistant] And I add to it the direction I want it to move in. And the direction is the small direction because it's a normalized vector.


[User] Please transcribe this text

[Assistant] And I multiply it by a certain speed. So now the bullet moved over here.


[User] Please transcribe this text

[Assistant] Alright, so if I do this, this is over here, in small increments, because it's a normalized vector. Alright, a unit one vector, moved in small increments. So now the first frame was here, the second frame now my bullet is over here. Okay, great.


[User] Please transcribe this text

[Assistant] And then the loop goes over and then now my bullet moves another frame or go to the next frame. Now my bullets over here. So my bullet has moved to locations. My bullets over here. Okay.


[User] Please transcribe this text

[Assistant] What if the player goes here? By the time I do those two frames, my player goes here and he spawns a bullet over here. Okay? Notice what happens now. When I click my mass button, I push a new bullet, which is this bullet. I push a new bullet.


[User] Please transcribe this text

[Assistant] And I get the last bullet in this list.


[User] Please transcribe this text

[Assistant] Which is size minus one, which is, I have two bullets. So the size is two, two minus one is one. So index one is the last bullet in this bullet list, index one. So we have index zero, index one. This is index zero and this is index one.


[User] Please transcribe this text

[Assistant] I set its position to the player position, which is over here. Great. And then, remember the split direction. Split direction.


[User] Please transcribe this text

[Assistant] Which was pointing, right, this little direction, which was now, was pointing this direction now, right?


[User] Please transcribe this text

[Assistant] How do I recalculate it? Well, I recalculate the value between the skeleton and my last bullet. This is i.


[User] Please transcribe this text

[Assistant] So now I, the direction is now pointing this way.


[User] Please transcribe this text

[Assistant] Right? And so, because this bullet over here,


[User] Please transcribe this text

[Assistant] And this bullet over here, they both use the bullet direction because look here, every frame I loop through all my bullets and I move all my bullets with the bullet direction, which I calculate is essentially here.


[User] Please transcribe this text

[Assistant] So when I, when I created this bullet and I calculated its new path,


[User] Please transcribe this text

[Assistant] With the last bullet and I normalized it, now the direction looks like this, which means the bullet, this bullet will no longer start moving in this direction or will no longer continue moving in this direction. It will now.


[User] Please transcribe this text

[Assistant] The direction has been updated to say go in this direction. So now the bullet will just go straight.


[User] Please transcribe this text

[Assistant] Right, because all the bullets are sharing the same bullet direction variable.


[User] Please transcribe this text

[Assistant] And so basically I loop through all the bullets and I say move in this specific direction, one direction, right? Which is bad.


[User] Please transcribe this text

[Assistant] Right? Because that means that all the bullets are sharing the same variable, and this direction will be changed.


[User] Please transcribe this text

[Assistant] Depending on which is the last bullet that I spawn. So all these bullets will follow where the last bullet. So if the last bullet is here.


[User] Please transcribe this text

[Assistant] And now I basically, this bullet will move down, right? If I spawn the bullet over here, which means that this bullet now will start moving down and this bullet will start moving down. So they all change direction because this is the last bullet that I spawned and it's moving down because they all share the same variable. Okay. So how did I fix that? How did I change that?


[User] Please transcribe this text

[Assistant] Well, rather than calculating the direction only once when I click my mouse button, I am going to calculate the direction every single time I update the bullet itself.


[User] Please transcribe this text

[Assistant] So now I loop through all my bullets and, and, and I can create the variable over here. I don't need to have the variable over there. I can still have the variable over there, by the way. It doesn't matter. Right? I can have the variable at the top.


[User] Please transcribe this text

[Assistant] Because every loop I'm changing the variable value. It doesn't matter, but I'm creating it over here, right? So now what am I doing?


[User] Please transcribe this text

[Assistant] When I press the mass button, I get, I add a bullet. I get my last bullet, I set its position. That's it. I just set its position to where the player is. Every single frame.


[User] Please transcribe this text

[Assistant] Right? What I'm doing now is I'm calculating the bullet direction.


[User] Please transcribe this text

[Assistant] For every bullet. So look, I'm saying skeleton, this is the target, minus bullet eye. And bullet eye, this is the loop, which means if I have 10 bullets, I'm going to get the first element because eye is zero and then eye will increment by one. So I'm going to get the second element and then I'm going to get the third element and I'm going to get the fourth element.


[User] Please transcribe this text

[Assistant] I loop, I calculate the direction, I normalize direction, I move that bullet in that direction. And then I loop again. I calculate a new direction for the second bullet.


[User] Please transcribe this text

[Assistant] And I normalize, and then I move that second bullet. And then I go again. I loop, I loop, and I calculate the direction for the third bullet.


[User] Please transcribe this text

[Assistant] Normalize the third bullet, I move the third bullet. Then I go again. I calculate the direction for the fourth bullet. I normalize the fourth bullet, and then I move it, I move the first bullet, right? So now, I'm doing this recalculation, I'm doing the direction calculation every, for every single bullet in a single frame.


[User] Please transcribe this text

[Assistant] So this is all one single frame. How is it single frame? Because I only went through this loop once, the main, the main game loop.


[User] Please transcribe this text

[Assistant] I only went through this loop once, and in this main loop, I went through all the bullets, so they could be 10 bullets. So every frame I go through 10 bullets, I update all the, I calculate their directions, normalize all their directions, and I move them in that direction.


[User] Please transcribe this text

[Assistant] And then the next frame, I do the same thing. If I didn't click my mouse button, if I haven't added any new bullets, I go through this loop.


[User] Please transcribe this text

[Assistant] Calculate their directions and then normalize those directions and then set their positions and so on and so forth.


[User] Please transcribe this text

[Assistant] If this bullet is moving down here, it's still gonna move down here because now I'm calculating its own, its position.


[User] Please transcribe this text

[Assistant] Uhm, I feel I explained this a little bit better, and I think I'm a little bit satisfied with my explanation. So now what I can do is end the stream.


[User] Please transcribe this text

[Assistant] And I am going to talk to you guys hopefully tomorrow.


[User] Please transcribe this text

[Assistant] And tomorrow we're going to clean up this mess. There's a lot of code, a lot of disgusting code, and then I'm going to clean it up. Right?


[User] Please transcribe this text

[Assistant] Two three-masted ships with black and white flags were unloading their cargo when Roland walked into the harbor surrounded by his personal guards.


[User] Please transcribe this text

[Assistant] The city hall officials were circling around the stacked wooden boxes while occasionally making sounds of excitement. Long time no see, your majesty. Margaret quickly came forward and bowed with a smile. Please forgive my appearance.


[User] Please transcribe this text

[Assistant] It's not suitable to wear long skirts while sailing at sea, so I hope you don't mind. The man next to her also bowed.


[User] Please transcribe this text

[Assistant] Your majesty, Sander Flyingbird of Twin Dragon Island pays his respects to you. Are you satisfied with what I'm wearing?


[User] Please transcribe this text

[Assistant] He then winked at him as he asked, Don't you think this quite matches the words high flying seabirds?


[User] Please transcribe this text

[Assistant] In fact, even before he spoke, Roland had already noticed his distinguishing dress.


[User] Please transcribe this text

[Assistant] To be honest, it would have been impossible to remain unnoticed when there were so many feathers on one's body.


[User] Please transcribe this text

[Assistant] His clothes were those of an ordinary sea merchant from the fjords, but they were covered with bird feathered tassels everywhere, from the bandana on his head to the soft leather shoes on his feet.


[User] Please transcribe this text

[Assistant] However, after the long sea journey, most of the feathers had become stiff and, though still attached to his clothes, they had now lost most of their luster.