Building your Spaceship Pawn (Part 2)

And then let’s move on to our constructions. So over here under function, we’re going to create a new function and we’re going to call it get spawn, location of projectile. Okay. And then for our input we’re going to do shots, fire and that’s going to be an integer. And then we’re going to do a for loop. Nope for loop. Bring in the last index, and then plus integer plus one. Penn Let’s see and stream and this is gonna automatically convert to integer to string and we’re gonna do spawn okay. So while that’s going we’re going to do loop body to cast to BP player spawn ship. And we’re going to do get player pawn just like before. We’re going to do a for each loop. And this is where we’re going to call in those, those end of ship and the children inside the end of the ship. So one moment I’ll show you what that looks like. Get end of ship, get children, components. World form right transform Make transform. plug these in, branch this out to another pre transform. And we’re going to grab in this array elements. And that is going to be get world. Oh, it’s not showing yet. Ah, there we go. So now we linked that and then we’re going to get component tags. And this is going to go to another for each loop, loop body Connect branch and then I will connect to these. So if this equals the spawn name over here, which is the return value, that equals that then true then spawn laser. And we haven’t made the spawn laser yet. So We’re going to make a spawn actor from class and I will show you guys in a moment. What we’re going to do for the spawn loser I believe Actually, we might have that I do a laser in here. No, I did not. Okay, we’ll make one real quick, very simple. Let’s connect that. Great, great. Great. So it’s coming together. Ah, get world can’t do get world transform just yet. We need to get world transform antastic All right. So don’t worry if you compile and it breaks let’s make that bet. bp laser so the BP laser is actually going to be an actor. Oh, not upon. Sorry. I did not mean to select that VP. Laser. And then let’s just make it a sphere. So add Static Mesh laser and do a sphere. And let’s just do laser pointer material is this fear not working. There we go. All right. Let’s shrink that down just a bit. Point 2.2 2.2. Okay. Fire that in a moment. So now that we have BP laser, let’s go ahead and compile. All right. Now if we run this actually let’s make sure our world settings is set up correctly. So we are missing a A game mode. So let’s just call make a new game mode. And that is under do game mode base. There we go BP game mode. And I believe we just want to add an overlay to this. So we’ll do Create Widget just like before, and call it Overlay and and to viewport. connect these together. Bam. Now let’s look let’s look over what we have here for the widgets. So we have an overlay here that is just a standard image that’s going to kind of create that arcade cabinet look very simple. We have The scoring info, which is going to give you your score and lies at the very top. And if you like to see what we did here, we actually are casting to the blueprint Player Controller appending it score from the Player Controller that it’s coming from, and then outputting it as a string. And then the lives is the same functionality. It’s grabbing from the Player Controller, the lives appending and doing that. And if you open up the Player Controller, we have lives, justifier, and score. They’re all open and public. And that’s it. Don’t worry, we haven’t had the functionality to actually increase the score or add lies or anything there. So if we hit play, oh, sorry, let’s go to here game mode base. Let’s do BP game mode. Select BP player pawn, BP player and controller. And that should be it. What What happened here? So if we go back to our ship pawn, we need to hide one end of ship. We need to hide this hidden in game. And then we need to hide all of these below. Hidden in game. All right. And then we’re going to take a look at the movement learning pawn movement. I must make some adjustments here. Okay. Moving on movement, velocity, negative one. plan our movement. some reason that’s not constrained to plane There we go. Fantastic. We’re gonna do 20 Custom, okay? max speed 1000 acceleration 3000. And you guys can always play with this if you’d like, you know that the values. Alright, let’s try it again. Ah, it’s not moving. So if you’re hitting play and you try to slow down, it’s speeding up no matter what direction I’m facing. So let’s take a look and see what we’re missing. So I realized why this wasn’t working as expected when we were flying. When you have that arrow, please put it and nested inside the ship. So remove it up to here and then nest it and then you will actually have moved meant, that corresponds to the way it’s supposed to. Okay, so for the ship itself, we’re gonna earn the end of ship. Let’s go ahead and disable everything here. So no collision, no collision, the spawn points are going to be the same. They’re going to generate overlap events, but they’re gonna have no collision on all of them. So no collision, and then the arrow of course, should be just fine the way it is. So if you had noticed we actually had