Building the Asteroids (Part 2)

Okay, now we’re going to move on to building out our asteroids. The first thing we’re going to want to do is build out a collectible coin. So we’re going to do a BP actor. And let’s just call it BP coin. And this is going to be kind of like our power up. If you want to actually build out a power up feature, or just have a coin that gives you extra points to your score, you can do either or this is just a placeholder for now. So we’re going to add a static mesh. And let’s just do a cylinder. Excellent. And we’re going to shrink this down to about there and let’s do point 3.3. And shrink this down a little bit more, let’s do point 10. Excellent. And then from there, we’re just going to add in our collectible material that we already provided. And then we’re going to add in a rotating movement. And let’s just make sure our rotating movement has everything set. So rotate rate 90. And I believe that’s all we need to set. Yep, that’s all we need to set for now. So let’s compile, save and then we’re going to create our asteroid. So our asteroid is going to be another blueprint actor. We’ll call it blue blueprint asteroid. All right. And the same process again, add a static mesh. We are going to just do asteroid 01 and asteroid map. Let’s look for our asteroid map. I’m not seeing the asteroid and map. Did I accidentally remove that? I believe I might have accidentally removed that. That’s the case we can add it back. It’s no problem. Yep, I did remove it. So let me go ahead and add that back for you all. And don’t worry, I’ll have this in the final project for you. So Okay, asteroid maps are showing up now. Let’s just make sure that they get the right textures, right they are. Alright, so now let’s add asteroid, math one, and then we’re gonna scale it to about 75. And then we’re gonna add in projectile movement and rotating movements. So let’s set up the rotating movement. First, we’re going to do a pivot translation of one. And I believe that is it for there No, no rotation rate. So let’s bring that down to zero. And then projectile movement. This one we’re going to set up initial speed of 500 and bounciness, we can do point five, bring these down, down. And then under velocity, we want it Stay at one. Now planar are playing our movement where you’re going to do one. And then 20 like before, make sure it’s set at custom. Excellent. Okay, so now we’re going to create some construction scripts. So we’re going to first do select static mesh. And we’re going to have it pull in our asteroids. Let’s call this asteroid. Drag that in. Do select static. Let’s do switch on integer. And let’s do a random integer of three because we have three to choose from. Max three Set that and we’re going to add three pins. So let’s do select or set, static, mesh, asteroid, asteroid, one duplicate, connect asteroid to duplicate to net, asteroid three. And we’re going to connect the all to the asteroid mash. And now it’s going to essentially pick between the three and give you one of those meshes. But now we’re going to actually want to do some changes here for the materials. So let’s just duplicate this and call it select asteroid material. And for that, we’re going to do set material for these instead of set Static Mesh we’re going to do set material. So the first one asteroid, map, one, duplicate asteroid, map to duplicate asteroids, map, three. Make sure you connect to the target of the asteroid pile save. And then we’re going to make one more function and that’s going to be chance to spawn our collectible branch. Do a random integer of, let’s say 101. And we’re going to do integer less than or equal to one. One Note sorry 10 There we go. So is 10 less than less than 10 or equal to 10 then spawn the collecting the blueprints for bulk spawn actor from class, we’re going to do VP pointing this out just a little bit and we’re gonna add in a variable. So we’re going to remember our death location so that is going to be a vector. So remember where we died. spawn in the coin on that spot or sorry, where the asteroid died not where we died and then destroy after Right after oops. Excellent. So I think we’re good there. Yeah. Okay. And let’s go back to our asteroid and make sure that we set up the collision properties correct. So we want to do simulate character step on of course now, we want to do custom collision enable, yes, world dynamic, ignore and enable all of these. Why am I enabling this? Alright? overlap. We don’t want to block. There we go. Perfect. And let’s remove cast shadow. We don’t want it to cast any shadows and then let’s start building out the function. analogy in our Event Graph. Okay, so we’re going to do event after overlap and we’re going to cast to BP laser and connect that to other. And if leezar hits destroy actor and then we’re going to add in a couple new variables. Call it Oh, interesting. So I made a mistake on the chance to spawn duck location. I did a local variable I meant to do a regular variable so apologies. Death location. I’ll save. Go back to the Event Graph. And we’re going to do sets that’s location. Get world location of the asteroid and then cast, the BP player, controller. It Player Controller. Excellent. We’re going to do some math. So we’re going to grab the score, get score, plus score multiplier, so we need to make a integer called score multiplier. We’re going to make that integer. And then actually, let’s just create a couple more variables while we’re here. Or vector. Let’s make that visible, visible, visible and then we’re going to make one called transform vocation. And that is going to be a transform. Excellent. So transformer locations. There we go. You don’t want that to be open. Right? So we’re going to pull in the score multiplier. And we’re going to multiply that by 100. So you get 100 points. Connect that here. connect that to there. And then score in this up just a little bit. We’re gonna play a 2d sound. Call it asteroid explosion. Then we’re gonna spawn actor explosion we don’t have that set. So we’ll leave that blank for the moment. We’ll go ahead and tell it where it’s gonna spawn. So get actor transform, break the Transform, made transform and want the scale to be one. So leave that as is perfect. Okay, we’ll come back to that explosion momentarily. And next we’re going to add in a option to spawn to more asteroids with About half the scale because if you recall in the original asteroids, they do break into multiple pieces. So score multiplier greater than equal to two. If true spawn collectable up top, I shall bring it right down there. We’re gonna do one after from clips on actor from class to do BP asteroid and now we need to grab that death location again may transform and then we’re gonna do get after transform and as this is where we’re going to shrink the size break transform Scale multiply by float. And we’ll do point 50 and set that as the scale here. Excellent. And then we’re going to do essentially the same process again, we’re going to spawn another asteroid. We’re going to set the score multiplier. Set the spawn transform again to the same spot. duplicate this and then chance to spawn collectable. Okay. So let’s go back down to the BP explosion and figure out what we’re missing here. I believe this was just a mistake on my end. So e explosion. So let me go. Let’s create a blueprint called emitter. Call it VP explosion on the emitter, we’re gonna grab, it’s pretty straight forward. We’re gonna do p explosion. There we go. You can see it in real time. So we go back here. Do BP explosion excellent. Pile save. So now we got the first bit here. So now it’s what essentially is happening is once you hit the asteroid, it’s gonna explode. And it’s gonna break into two pieces and then there’s a chance for spawning a collectible So let’s take a look. Let’s see. We need to connect that to destroy the laser because we don’t want the laser continually acting up. And then we’re going to do overlapping with if you were to hit the ship. So what happens if you accidentally hit that ship? Well, it’s a good point. So cast failed. We’re going to do cast to BP player ship pawn. We’re gonna again, destroy actor and then destroy the regular actor. Let’s grab the play to the sound player death I’ll save we’re missing something Hear, oh, I never connected it to the other after Silly me. There we go. I just like to compile as I’m moving along, makes things a little bit easier for me. So we’re actually going to grab that this function here. We’re going to bring it down below. There we go. Now we’re going to cast to get Player Controller, and we’re going to cast to cast Ubp player troller and link those back up. And then we’re gonna do a little bit of math for our lives. So we’re gonna decrement buy one every time. So grab our light value and then it equals zero. We want the branch to go true and we want it to destroy the actor. And essentially what’s going to happen at a later date is once it’s destroyed, it’s going to play like a game over screen. If not destroyed, though, we can set the transform location. And we’ll set it based off of this where we initially died. And destroy actor. Excellent. So that’s actually part of our asteroid. We actually have quite a bit more to complete but let’s take a break and on the next video, we can actually resume from here. Thank you.