samfred2 commited on
Commit
c6e885c
·
verified ·
1 Parent(s): 45e40cf

[flow_default] Transcription: 005 Connecting game mechanics.json

Browse files
transcriptions/005 Connecting game mechanics.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_file": "005 Connecting game mechanics.wav",
3
+ "text": "Hi everyone, welcome to your next tutorial where we're going to be looking at some of the game mechanics. So to start us off, let's see how we can make our player lose the game by touching the lava. So what we're going to do is we're going to go, so let's go to our world outliner here. And let's actually let's go to our content drawer first. Let's go to content, third person blueprint, blueprints, and let's double click on our third person character, because we're going to change some stuff over there. So to start off, if you go to the event graph, as you can see, there's all the inputs and everything else from the player, but we're going to work on the separate area where we're going to create the data animation for the player whenever he hits the lava. Basically, it's a ragdoll animation, which is going to make all its joints to go ragdoll. And it looks pretty good. So let's get into that. So for that, I'm going to go ahead and create an action first. So I can demonstrate this to you. So let's, um, let's grab the tab key from the input. And this is just so I can show you how to do it. But, um, we're not going to be using the tab key in the, in the game, we're actually going to be using a custom event. So let's just already create this custom event right here and it's going to be the ragdoll animation. Perfect. And to do that, it's pretty simple. We're going to go and get a reference to our mesh script. So if you go to the third person character here all the way top in the components, we can drag the mesh script right here and we get a reference to it in the reference. We're going to drag it In the reference, we're going to drag it from the reference and we're going to search for set collision enabled and we're going to set the mesh to the target. And whenever we press tab, we want the set collision enable and whenever our event starts, we want to set collision enable. Perfect. And also this collision should be effect, should affect query and physics. So just make sure collision enabled, query and physics is on here. Otherwise, it's not going to work. The next step to the direct though effect is to work around the physics of our character. So what we're going to do is we're going to get again another reference from the mesh and we're going to do set simulate physics. And in the set simulate physics, you can drag this just to look nice. In the set simulate physics, we will just connect the event flow. And this is just saying, hey, let me change the physics of my character. So I'm going to press simulate here. So it actually simulates the physics for my character. And after that, the last step is to just change the physical blend wave of our characters. We're going to drag again from the mesh, we're going to place a new node and we're going to set set physics blend wave, and we're going to set this to one. This is going to enable simulation so our character can actually go ragdoll. So we're going to connect this to this. And let's test this script by pressing tab in our level. So if you see here, I have my character. So if I press tab, he goes ragdoll and he kind of falls over and we want that to only play whenever he touches the lava. So what we're gonna do right now is we are going to create a collision for our lava right here. And basically it's gonna be a obstacle kind of thing where if the player overlaps with the obstacle, which is gonna be the lava, we activate the ragdoll animation and he fails the level. So what we're going to do is we're going to go to Content drawer, we're going to go all the way back to content, let's create another folder. Let's call it Obstacles. Let's go inside Obstacles and let's create a new blueprint class that is going to be a parent class of actor and it's going to be called Obstacle. Perfect, let's double click our obstacle and let's now add a plane here. Awesome. So this is our obstacle. And another thing that we have to do is we have to create a collision. So we're going to press add and let's search for collision. We're going to add a box collision to our plane. So whenever we basically want whenever the character enters this box, we're going to add a box collision to our plane. So whenever we basically want whenever the character enters this box, we activate the ragdoll animation. So let's just drag a little bit here. So we kind of like fits the plane doesn't have to be perfect. scale a little bit more, because I want the ragdoll to activate kind of like mid air. So this is good. What I'm going to do now is we're going to press the on the collision box over the box collision. We're going to screw down and you're going to see that we have very lots of custom events here. And we're going to hit the on component begin overlap. We're going to hit this plus button, which is going to just call the event right here for us in the blueprint. And here's where we're going to call our character to ragdoll. In order to do that, we need to check for the overlap on the other actor. And the other actor should be connected to a cast to our third person character. So just basically being means that, hey, if it's the third person character in overlapping with the box, you should execute that. So if the cast succeeds, we're going to just call the ragdoll animation and just make sure that your third person character is linked with the target itself, otherwise it won't work. Perfect. So now let's go back to our level. Let's open the content drawer. So let's drag our obstacle in. Let's make it a little bit underneath the lava and let's scale its axis. Make sure you don't scale it completely like that. Otherwise the entire box is going to be floating the air. So the actor might enter ragdoll whenever you don't want him to enter ragdoll. So just make sure you scale on the red and the green axis. So let's do that. Let's do that. Perfect. So now if we hit play, make sure you scale based on the lava. So like the lava they have in your environment or whatever. And now if I fall here, my character enters ragdoll and yep, it's over for him. So now that we created the ragdoll animation, let's go back really quickly to our UI and let's duplicate our level, complete it and let's say level failed. So we have a UI to show whenever our character falls. Let's go to level failed right here. Let's change the text to level failed. Let's center this a little bit more. And also let's add an image to it so we can fade like we can fade from transparent to black. So you get the nice transition that the level has ended. So let's go ahead and scale this up. Let's make sure our anchor fills the entire screen. Let's set the color to black and the opacity or the alpha to zero for now. Perfect. And now let's create another animation. It's going to be called fade image. Actually, we can create in the same on the fade when we can also We can just add another track. So let's do that. So we're gonna remove the fade image Let's add in fade when let's go here and let's select our image add another track for the image Let's add a track on the Color and opacity I'm gonna upscale this gonna add a keyframe. And then at the end, I wanted to fill the alpha to one, so it's all black. Perfect. Level failed. Cool. So let's also change our text animation here. So let's grab the the alpha of the background and just drag it to four seconds. And then on the render opacity of the text, you see the fades in but then it just fades out when the image shows up. So let's just drag the text to be on top of the image. So that way it doesn't fade. And then at the end here we can just fade out the text or we can actually just leave it as it is it's good enough. So let's just make sure that the image duration takes place in four seconds and then the text fades in in like one second so as you can see has this good fade-in animation that you failed the level we can either decrease this from four seconds to 250 let's play this again as you can see there's this move animation so yeah also make sure that your text level filled is on top of the image that way you don't have any issues like I was having cool so. So let's compile, save. So now if we go back to our third person character blueprint, what we're going to do is after it went ragdoll, we're going to add a delay of about two seconds. Once it's completed, we're going to execute a level restart. So now let's restart. So the restart is going to be a custom event. So let's add a custom event. It's going to be called restart. Perfect. And let's drag completed to execute the restart. There you go. Let's drag this restart all the way back because what we're going to do now is going to grab this mesh again. So a reference for a mesh. We're going to basically undo what we did here. So we're going to set to no collision, connect the mesh. We're going to set simulate physics to normal. So do not simulate and the physics blend way to zero again, make sure you connect your targets with your mesh. There you go. Perfect. Now let's compile save. So instead of setting every property here to reset and to actually go ahead and reset the level. The easiest way to do it right now is to just instead of setting all these properties back in, what we can do is we whenever we restart, we just open a level. And then we're going to just basically recreate this level with the level name called level one. That way we don't have to deal with resetting every property, at least for now. So let's compile and save. Let's go back to level one. And now if we fall in lava, it's going to have the cutscene level failed. And it's going to remove everything and just go back to the beginning, because we just reopened the level. Of course, if you have like level checkpoints, you're going to have to handle that differently the way I showed before. But you also have to reset the UI and such. But for now, the simple mini game, this works great because we can just reset the level as it was and we don't have to mess around with any of the UI changes, etc. Cool. Thank you so much for watching. I'll see you in the last tutorial of this series where we're going to be completing the game. Thank you so much.",
4
+ "language": "en",
5
+ "confidence": null,
6
+ "duration": 691.07
7
+ }