Building your Spaceship Pawn (Part 1)

Okay, the first thing you’re gonna want to do is open up that asteroids blank folder that I provided. And let’s launch that I am using four dot two, four, I believe four to five and above should work on this. And the first thing you’re going to notice is that I actually provided you all with some base assets, some very basic things like the earth blueprint that will show it, you know, kind of spinning around, let me reduce that. And some little things like the game over screen, and Main Menu, things like that. So let’s go ahead and start. So the first thing we’re going to want to do is grab that asset, that spaceship asset, you guys can take a look here, what it looks like. And all these are available online on either turbosquid or cgtrader for free, so feel free to grab any type of assets you like and Make your own. So let’s go ahead and start. So I’m going to the blueprints section. We are going to create a new blueprint class, we’re going to call it a pawn. And let’s call it let’s say BP player, ship pawn. Alright, let’s load this up. And then we’re going to add in a floating, floating porn movement. And then we’re going to add in our static mesh. build this out. So the static mesh, we’re just going to call ship Let’s grab that spaceship. All right, so you can see it’s pretty massive. So I actually know that we’re gonna want to shrink this down 2.3 perfect. Next we’re going to want to add in another Static Mesh or actually, we could add in a plane if we’d like. So let’s do static mesh. And let’s call that the end of ship. This is going to be kind of where our projectiles going to be firing. And let’s do plain and let’s just do basic shape. material so you can see it easily 90 Let’s just move that Little about there, and let’s make it four by four by four. Okay. And let’s add in an arrow for the direction that we’re heading. So let’s just attach it to the roots. Bring it to about the nose. Actually, we can go about there, compile, save, and then we’re going to add in a spawn points. So let’s go ahead and add that in. spawn points are just gonna do under the end of ship. We’re going to call it 1.1. We’re going to do a sphere and then and collectible for our collectible icon color. Right. So we want that to be visible. I’m not seeing it. Show up. Let’s take a look here. This a little back. Look, here. Let’s grab a different sphere. There we go. Okay, there we go. Point three. Oh boy, that’s pretty big. Let’s do point one. Perfect. Wanting pawn movement. I must make some adjustments here. Okay. On velocity, negative one planar movement for some reason that’s not strained a 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 BP player pawn, I might have made a mistake here. No, it’s cracked LA City t minus one. So in the next thing we’re going to do is we’re going to actually add in what’s called a variable and we’re going to do previously kit and this is gonna be like the location of where we are previously hit. Pretty straight as pretty straightforward. And make sure you do instant edibles so that way it can be called from other blueprints. And that should be it for this part. Now let’s go to the Event Graph and we’re going to do event B in play, and let’s grab the root of the ship. And let’s do some world location. Make sure it’s not rotation set world location. And let’s do 20. So it’s a bit high up, and then compile, save. And let’s just add a comment here and let’s just call it chips on. Let’s clean this up a little. Great. Now, you’re going to have actually these input accesses called move, you know, move forward ship movement forward, we’re going to do the access values. Oh, not that one. Input access ship. For movement, there we go. And to see where that is, you can go to project settings and under info Access mappings ship more for movement, ship rotation and then firing a spacebar we can make that control. I found that that’s a little bit easier to handle. All right. Okay, now let’s go ahead and grab that arrow. Let’s move this actually, we don’t need an Event Tick on this. So let’s do arrow, get forward vector because remember, it’s going to be the forwards basing. Multiply vector times float. And we’re gonna take the axis value and plug it in there. And then we’re going to do floating porn movement and input vector Let’s just clean this up a little bit I like I prefer to have a nice clean Blueprint Interface. It’s up to you though. Okay, and then we’re just going to do one more for the rotation, shift rotation. And just like before, drag in the ship, world rotation, we’re gonna do get, and then we’re gonna do brake rotator. And then we’ll go into make rotator. And then we’re going to do some, a couple values here. Let’s do such world rotation for the ship. We can actually get rid of that and just drag this over here and if you want to be clean about it, can kind of clean it up a little and make it look a little bit prettier. Well, we know that this needs to go about there. Alright, and then let’s do a multiply by one on the float. Oh, whoops, sorry. Let’s do multiply, float by float. Let’s just do one for the turned speed plus float. Let’s bring that here. z. Bam, bam, pitch. Awesome. Now, if we go ahead and go to our maps, let’s load in the main level. Alright, so you’re going to notice a couple things. We have a sky map The sky map. And then we also have a directional light camera actor. Let’s just call them camera actor, and sun BP. We’re actually missing the earth blueprint. So let’s go into blueprints and dragon that Earth blueprint. And don’t worry about positioning we will figure that out shortly. So let’s go to the top. Let’s just assume that’s the center as the camera actor. So let’s just take this guy, bring them in over here. Let’s assume that he’s gonna be sitting over here. We’re gonna add boundaries in a moment, once we get a little bit more comfortable. Okay. perspective. Fantastic. All right. Okay. Now if we were to hit play, nothing is going to happen. We’re just going to have kind of a Floating camera, some music playing and I’ll show you what to do next. So if you go to your Level Blueprint, you’ll see that there’s an audio component here for audio. Now we’re going to actually open this up and we’re gonna go let’s see, we want to set the camera first. So let’s do set view target. out. That’s not it. Let’s drag in that camera actor. So go back here, click on the camera actor, analysis, so show up here. So create a reference to it and set view. Target with blend that’s not showing up interesting. Let’s Try this Player Controller. There we go set view target with blend, camera after the blend. And then we want to add in that overlay. Great widget. We’re going to create that web score and info overlay. Now I’ll tell I’ll briefly talk about how that works and the viewport. Great. Now we’re actually going to have a viewport showing up. And let’s add a variable in here called is dead. We’re going to do a check on whether or not the character is dead. And then we’re going to do a set timer by function name. So this isn’t going to work just yet. And there’s a reason for that. This because we have not actually created the spawn asteroid function. But we are going to do that very soon. So just be patient. The next thing we’re going to want to do is add in the cast to be playing the player ship pawn. And we are going to do get player pawn and then we’re going to do a function called bind. events on destroyed. Let’s see, I don’t want to unbind I want to bind find event on destroyed. There we go. Fantastic. Okay, our custom event and we’ll call it on destroyed event. We’ll add a slight delay here, about point two of a second. And then we’re going to actually stop there for the bowmans. Because we’re not going to add the next bit of code until we actually have everything finished. So starting from here, we’re going to add do event. Begin Play. It’s going to look for this timer, but this isn’t going to work just yet. So let’s break that link.