[flow_default] Transcription: 004 Creating the platforms.json
Browse files
transcriptions/004 Creating the platforms.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_file": "004 Creating the platforms.wav",
|
| 3 |
+
"text": "Hi everyone, welcome to a new tutorial and today we're gonna go over how to create obstacles for our lava mini game. So what we're gonna be creating is this platforms that move from right to left or left to right and you need to jump on them to avoid falling in lava. So it's gonna be really cool. Before we start, I'm gonna select all of our rocks right here or actually I'm just gonna select one and go to our static mesh and I'm to remove all the collisions of it because right now we have the box collision in place and if I would walk over it as the box collision would be too offset sometimes I would be like falling to lava and I would step into the collision box and I don't want that to happen in this demonstration so that's why I removed the collision you're more you're more than welcome to keep that I just removed it so I can show you later on on how the lava is going to affect our game. Alright, so now let's create our platform. So to do that, let's just press Ctrl Space. Let's create a new folder. And this folder is going to be called platforms. Let's double click it, right click it, and let's go to Blueprint class. We want to create a new Blueprint class. If it's not showing up here for you, you can also go to blueprints and it should be there, the blueprint class. So let's go ahead and pick a parent class. So let's select the actor and let's rename this to platform. Perfect. And now let's double click and let's create our squared platform. I'm just going to dock this to my Unreal Engine. To create our platform, we're going to create, we're going to press add here to add a new component and we're going to add a new cube. Let's scale this cube a little bit. One, two, one, two is good. And then let's shrink it. There you go. So this is looking like a platform. I think that's good for now. I'll keep it this way. And what we're going to do now is we want the platform to move from right to left. So we're going to go to our event graph. And before we do that, I can actually compile and save this. And let's just drag this into our level. There you go. Let's lift it up a little bit. And let's just drag it down a little bit. Perfect. Our platform is here. Let's go back and let's go to our event graph. So you are in viewport, just click on the top tab, event graph. Let's delete the two last ones here that we're not going to need it, but we will need the event to begin play. So what we want to do is that whenever our level starts, we want our obstacle to move. So we need a timeline and basically this node called timeline is going to be able to allow us to create this movement animation. So by creating the timeline here, we can double click it. And we can actually add a new vector track right here. And what this is going to do is that we're just going to set the position and the time that we want our platform to move. So if we go back to our level, as we can see, we want to plot the platform to move from left to right. And left to right is actually messing around with our y axis, which is the green one here. So back into our platform, we wanted to move only in the Y axis. So we're going to lock the X and we're going to lock the Z. And we're just going to leave the Y axis here. So let's start keyframe. I actually want a full cycle of this platform to be about 10 seconds. So what I'm going to do is I'm going to create the timeline with a length of five, and we're going to reverse the animation that on our event graph. So just bear with me. So right now I'm going to add a keyframe by pressing shift and clicking to the beginning. And this is going to be time zero value zero. And on five seconds, I'm going to add another keyframe by pressing shift and clicking. And the value is going to be about 500. So there you go. And if I press this, the zoom to fit vertical, you can see there's a, that's a linear line right here. And the animation will go from zero to five seconds from zero to 500 position on the Y axis. Cool. Let's compile save. Let's go back to revamp graph. And now whenever we update the timelines, whenever the timeline is updated, we want to set the relative location of our cube. And to do that, we can just drag a reference to our cube. And let's just set relative location. Perfect. And whenever we update, we wanted to go to the execution flow of the set relative location. And we want this new location to be the location and the timeline. So just drag the new track zero to the new location. Awesome. Looking good. So now we have to match that delay there that we created in our timeline that so the platform actually takes five seconds to go to all the one all the way to the one side. And then it's going to take five seconds to go back. So we're going to have to reverse the animation, but we have to add a delay in between. So we're going to go and we're going to grab the execution flow from this one. And we're going to type in delay, let's click the delay. And let's set the delay to about six seconds. So we have one second of the platform just staying in place. And yeah, awesome. So whenever the delay completes, we need to check if it's looping or not. So actually, first let's create a variable on the left side. Let's go ahead and press plus here. Let's create a variable called loop. And this variable, let's compile and let's set a default to true. Let's drag this into our blueprint. So we want to get the loop here. So right now we're going to add a branch. So this is just the if else statement, and this loop is going to be the condition. So once it's completed, if the animation, so if it went all the way to one side and we haven't reversed it yet, we want it to reverse the animation and play again. Otherwise, we just want it to play normally, and we need to do that for an infinite set. So what we're going to do here is whenever we say true, we need to set our loop variable to actually to be false, so you can loop back around in a different way. And whenever it's false, we're going to set our loop variable to true. There you go. Cool. So let's just connect now our true set here, that's setting our loop to false to our reverse node, which is all the way back. And to make this more organized, you can just double click it on the line and just drag it up. You can make this look nice if you want. I'm just gonna do it like this. And whenever it's false here, we want the loop to set it to true. And we just want it to play again from the beginning. And you're just gonna, oops, so we can't set the boolean. Of course, it's the execution flow. Let's go back, double click it, there you go. So what this is going to do is we're going to play our animation and we're going to set our cube to that location by adding a delay in the satellite relative location. So it's going to take six seconds to complete one cycle because our animation is five plus one that the platform is going to stay in place. And then whenever it's completed, we're going to say, okay, was it looping? And if it's true, we're going to set loop to false. And we're going to go and reverse our animation so the platform can go back to its original position, and it can basically loop around. So let's see how that's going to work. So let's set our platform to an initial position right here. Let's hit play. And as you can see, our platform is moving all the way to the right. Whenever it hit the 500, it's going to stop and move back. And congratulations, you just created your first platform. And as you can see, just moves back and start looping around. And that's what we were creating. Oh, no, this would have been bad. And exactly that. And that's how you create your first Alps to go. So let's now duplicate this and actually create a new one all the way over there, over like right here, or like in between actually, because we just removed the collision here. So we want the player to jump between these platforms. So let's go ahead and press Ctrl W. And let's duplicate this. Perfect. And let's press play. And as you can see, all the platformers are moving, but they're moving at the same rate. And we don't want that. Cool. So let's fix that in order to fix their rates, like going back and forth at the same time, what we're going to do is going to go back to the platform. So we can either go minds already open, we can just go through here. And we're going to edit something, edit some things on our blueprint. So the first thing that we're going to do is we're going to remove the delay because the timeline has the finished property. So we don't actually need a delay. So we're going to remove the delay and instead we're going to connect to finish. Let's just scroll the way down to get a reroute node and connect the finish to the branch. That way we just add a delay if we need the platform to actually stand there for one second. But I'm going to remove that so that whenever they reach the final destination they can just come back and reverse. Perfect. So now what we're going to do for it to change the rate of them, we're going to add another variable called, let's say rate. And let's make this a float number. Perfect. And let's also click on the I here so we can, so this variable can be public. And we can access that through our level here. So perfect. So we have the rate now. Next thing that we're going to do is we're going to get a reference to our timeline. So we're going to drag and drop the timeline from components here, get the timeline, and then with the timeline selected, we're going to place a new node called set play rate. And this is going to change the rate of our animation here. And to do that, we're gonna drag from the new rate. Actually, we're gonna grab the rate variable that we just created, we're gonna drag, we're gonna say get rate, and we're gonna connect the new rate to our rate that we established here. Perfect. And now what we have to do is we have to loop this around and play differently based on our rate. So to do that, what we're going to do is we are going to disconnect the play sections from the timeline. You can just hold Ctrl and drag it out. Perfect. And we're going to put this guy right in the middle here. So what we're going to do is we're going to connect the set play rate to the play here and the event begin to our set play rate. And let's go back and let's get this loops, um, plugged back in to the set play rate instead of the play. Let's go back in and plug back into the set play rate. Oops. There you go. But as you can see, there's a major problem right here that it's not differentiating if it's going to play or it's going to reverse. So we need to branch here and check the loop variable again. So let's disconnect the play and let's add a new branch. With this branch, we can connect the control flows, the execution flow, and we can grab our loop variable and we're gonna grab its getter and it's gonna be our condition. So if it's looping, so if it's not looping, what we're gonna do is we're gonna just play. But if it is looping, we're gonna reverse. But there's another major issue here is that if we go ahead and we click play, nothing plays. And that's because it's never going to play because it's true. The loop default variable default value is true. So whenever we start the game, it's never going to play because true is going to reverse the animation animation, it's already on its starting point. So it won't happen. So what I'm going to do is I'm going to create another variable here called just created. And I'm going to set to a Boolean. So I'm going to check if the level was just created. And I'm going to set this once. So I know that the level was just created. So I'm going to play it once in the timeline. So what we're going to do is we're going to get a reference from this. So we're going to just get it again, going to get the just created. And then we're going to get another branch and the just created is going to be the condition for our branch and if it's true here instead of reversing right away we want to check if the level was just created. If that's true we want to set just created to false so we never go back in again so we're going to set it to false so we deselect this so make sure it's not selected the box is not selected and we're going to set it to fall, so we deselect this, so make sure it's not selected, the box is not selected. And we're going to hit play. Otherwise, if it was not created and it's actually looping, we want to, we want it to reverse. So there you go. Let's compile, save, let's go back to our level and let's see. Oh, nothing's going on, of course. So in our platforms, we're gonna choose we're gonna change the rates. So the first one is going to be a one. So it's going to be normal speed. The second one is going to be twice the speed of the first one. And the last one is going to be half of the speed of the first one. So if we hit play now, we can see our platforms are moving in different rates. And it actually looks like a game. Oh, I'm terrible at it. As you can see. So yeah, now that you have your platform set up, it's time to create some of the programming. So this looks more like a game and not just like a platform tester for our tutorial. Cool. So I'll see you in the next tutorial. And I hope you enjoyed.",
|
| 4 |
+
"language": "en",
|
| 5 |
+
"confidence": null,
|
| 6 |
+
"duration": 879.98
|
| 7 |
+
}
|