 This video was brought to you by my patrons. Thank you so much for your support Hello there in this video I want to show you how I implemented a moving platform system for kitchen tails my latest game I am currently developing it if you want to follow the development of this game You can follow me on each IO and you can also start the repository on github at the end of this video You'll be able to make platforms that move on vertical movement So the character will be snapped to the vertical movement as you can see it can go up and down You'll also be able to make horizontal movement platform You can see that the character is snapped to the platform itself And also you'll be able to make any kind of movement really even circular movement But any kind of movement the character will keep snap it to the platform. So without further ado Let's get started the first thing that you have to know in order to achieve this system Is that the platforms themselves don't need any code at all? But in your character movement of your game So in the player movement you just need to switch from move and slide to move and slide with snap So you have to use this line of code here, but besides that you don't need any other thing So to design the platforms Let's create a new scene here I create a new 2d scene using a no 2d and I will name it moving platform And the first thing that you have to add in this scene is a kinematic body because since the This object will be moving it will be interacting with the physics as well So with collisions and for moving objects you have to use the kinematic body 2d And kinematic body 2d need a collision to well interact with collision body So let's add a collision shape and I have here a script that allows us to draw in the editor some shapes So I would drag it here and zoom in focus again And this script basically just draw the shape with a color So if you go back here, I will create a new shape and you can see that any shape will be draw Using this color. So if you want to get this script I'll put the link to the description as well is a script that I'm using for my designs here So every design here use this kind of script to draw in the editor And I will use a rectangular shape 2d here and let's create this shape here And the next thing that we have to use in your to achieve this platform movement is a path 2d Because this path is what we will use to design the path that this moving platform will use in its movement So path 2d and we will also add a path follow as child of this path 2d And as child of this path follow will use a remote transform 2d This remote transform 2d is what will change the movement of this kinematic body So let's set this remote path to be the kinematic body 2d here And the first thing that you have to set up in order to achieve this moving platform system Is in the kinematic body, you see that in the motion category We have the sync to physics and if we see the description for that It says that if true the body's movement will be synchronized to the physics frame This is useful when animating movement via animation player Which is exactly what we'll do next So for example on moving platforms, which is exactly what we are doing So we'll turn on this setting here And the next thing that we'll do is create an animation player So add an animation player to this moving path form here So the first thing that we have to create here is that we will design a path So I already have some paths, you can create your path using this Plugin that Google offers to design paths So if you want to create your custom path, you can basically draw it And you can also set some curves as well if you want But I already have some paths here So I have a wave path and a circle path and a vertical and horizontal path I will first use a vertical path here So it has a starting point and an ending point And then on the animation player, we will create a new animation We will create a ping pong animation path Follow And in this animation, I will set it's time to be two seconds We will animate the path follow unit offset We'll turn off this rotate property here Because we don't want the platform to rotate with the path So we'll turn off this rotate property here And then in the animation player, we'll also set the playback options The process mode to be physics So everything is synchronized to the physics frame And then in the animation here, we will create a keyframe for this unit offset Create And in the middle of the animation, we will create a new keyframe With the unit offset set to one And then we will set this animation to loop So it will go to this point and then go back here And this is what we got So you can see that it's blinking here on the screen And this is because here we can actually set the unit offset to 0.99 And it will go to the end and then go back And this blinking will vanish So we don't have this bug anymore So we just fix this bug And if we want to create circular paths So just like I have here this circle path We can drag and drop this path to this path to D And you can see that if we have this ping pong animation It will go here and then back and then here And we can create a new animation That will just make it finish the movement And start all over without having to go back I will create a new animation here And I will call this loop path follow And I will set it to have just one second And we'll also have this unit offset to 0.99 Actually here we can set it to be 1 So it will be a complete movement And we can also set this to be loop But it will not go back because this is the last frame So it will finish the movement and then start all over from here So you can see that this is the movement that it will do And this is it This is everything that you need to set up a moving platform in Godot 3.1 So if we go back I will try to design a new platform So this new platform will basically do this movement And bring the character to this floor here So I will drag this character here And I will create a new platform So I will drag this moving platform scene here Let's focus on it And to design to make your level design With this moving platform system You can basically just toggle the editable children This is because you can override the properties of the original moving platform So if you have something set in the original scene You can override it by toggle this editable children And what we will do is that I will go here into this path to D And I will create a new curve And for this curve I will basically set it to do this Then this And just zigzag until here And then it will go here On the animation player I don't want it to be loop and path follow I want it to ping pong the animation So it will go to the end and then go back So if we test this now You can see that it will go to the end And then it will go back to the original position But you can see that this is quite of fast, right? So if you want to change the speed of the movement You can go here in the playback options And you can decrease the speed of the movement So I think that I will use 0.50 So it's not too slow but it's not too fast as well So if we play here we have this It will go to the end and then go back And I will jump to it And you can see that the character is perfectly Snapped to the platform So that's it for the moving platform If you want to download the complete project So with the jump playground With the dash playground With the dash mechanics with the character control You can download the physics prototype The kitchen tails physics prototype On the kitchen tails HIO page This is only possible to offer This is only possible to create Due to the support of my beloved patrons So if you want to support me Create more of this kind of content Not only videos, not only tutorials But the whole setup that you can see here You can support me by becoming one of my patrons And I will appreciate this very much We will get some rewards and exclusive perks But that's it for this video Thank you so much for watching Keep developing and until the next time