Create your first game in Unreal Engine 5 - Auto-jump platformer from A to B

Lets get to know another platform that would be here the bvp blueprint John Im going to place it here and John is for jumping Of course lets see if I remember because they are all white boxes Well here I killed myself and as you can see whats left is the little man jumping to see how we implement it Im going to open it here So its really very simple here as you can imagine its good that you get familiar with this and here you can see that we also have two things on the one hand here we have the collider which is the little yellow thing here and on the other hand we have the mesh here you can see the collider so these are little things that little by little Im improving too so at least for the moment I have it defined here look well the structure is the mesh which is the platform Here I can also place platform which I like here we have the box which is the box Collider Remember that if you give it here you search for Box Collider I say Box Collision which is called and that would be there you would add it within the platform that is to say the mesh here we have it I always scale it so that it sticks out a little because if you leave it very flush then it will not take it or it may not take it at least for me according to the tests I have done I could adapt it a little more for example Here I also placed it from the edges Although it depends on the effect you want to give it I left it as is you can see although here I can adapt the size more if that is what I want at least for now I will leave it like that then go doing tests then there you can see what the mesh is here it does not say anything and we go with the graphic pair which is the most important part is what I did here Here you can see that they are these two boxes obviously here for the box you have to have Box selected here and here the events that you can use appear Remember that this is to detect collisions if we have all of these usually the vin Collider or the hit one is used so as to say whenever there is a collision or the but there are others here that I have not really used but there it is although again it is usually start in the middle and end then you can define what you want there this works in the following way here we place the little box that in this case is the one I defined Sorry this is the one from bellin Im going to start here when the collision starts that is to say as soon as it touches the surface what is it returned here the first thing is the actor that is to say that is colliding with it since it may be that you have a projectile or something like that and you start to hit the blueprints there and therefore by mistake or due to matters of destiny it hits the one therefore here you have to determine which actor you are going to hit to do something and usually it is also important because as a result of the hit or contact you usually want to do something with that other blueprint with which it is colliding and that is the one called here other actor Here we also have the one from the actor that I think was this one but I am not using it usually it is not used that much Although it is there it is needed so here what we do is cast the character in my case it is person queen character which is that little doll with horns that you saw over there and it is from here So this is a bit typical it is a cast according to what we have since if it collides with another object then the cast would fail and there you can do another thing if it is necessary for you Well here I put it I will explain to you a little about this delay here what interests us is to apply the Jump because it is a platform for the automatic Jump there are several ways there is a more complicated one I have not done it then I simply tell you Theoretically it would be to give it a force on what would be the Z axis so that it jumps but in this in this case we also have here a jump function that is in charge of doing that work here unfortunately I would love it is the only thing that I do not like the knots in theory that there is one called good definition that would be to see the definition But it does not work for me it simply gives me a message that says r more more symbols I do not know what the hell it is doing but I would love to see how it is implemented that is what I liked a lot about coding that when I had doubts about something I could take a look at the source code and there make some adaptation eye that is to say duplicate it and make some adaptation of my own for example I was interested in seeing how they do the Jump but it is not I have not been able to see it here then I do not know this button I do not know what the hell it really does anyway But here we have for our character that is to say the one that you casts here we already have a jump function here then You might wonder what the hell all this is here in the middle Remember that this is a kind of class that is to say we really have the class as it is here you can also see it if I look for the character here to see if I find it to see where it is Here I am in blueprints it is a class that has many things here is the rHere we have for example the component which is another class Here we also have the m which is another class and here we also have the m which is the one I am inspecting which is for the movement part Here too you can help yourself visually because in case you want to obtain something from here

You simply have to have this component that again I see it as if it were a class in a few words we have a class I dont know character And from there we have an internal property that is for the movement So thats what Im doing here Accessing the movement and navigation is that here we have ch mov or mov as it is pronounced and here I am accessing it from our character simply here you drag and write charter there is the one that would be this one that we have here and from there we have components that is the same that you can see here the speed and everything else and that is what we are modifying here I placed that it can change the jump factor that is to say apart from jumping I can indicate how much I want it to jump by default the jump function jumps based on what I have implemented that I can also define there but that is not the case that is this but you can change that jump value in this case I am changing it directly here on the platform and that is why here if I move I also put a variable to see where the advanced jun is to see that I dont see it its in the Word settings again Here is the jun Z factor which is a factor if I increase it more for example I put five it will jump a lot more then it is useful for certain levels or platforms whatever you want to do since I try to make it as reusable as possible Look there is already a platform outside and here you can see the result what is the problem with this which was why I did not want to use the J function sometimes is that when it exits the loop right now I continue showing all the rest of the implementation what it is doing here is that this jump is defined therefore this is the jump that it has if I come here all this jumps and if I leave the platform all this jumps which can be useful for a consumable or something but it is not what I want since I want only the platform to jump in this way so that is why we have the n there which does the opposite But before continuing this is what you can see here here we get the character and change the jump Factory as established so here this would be to make the set here we multiply the Jom Factory by factor that is to say that if for example this is 200 The Jump if you multiply it by the factor that in this case was 5 would be 1000 So that is what will jump we only establish the jun Z velocity and finally we call the jump function that uses this component to jump and here we jump this would be an event that I implemented it is not very important right now and I do not want to complicate the matter further but those are events that I use that the final was going to use for something that I am not using it for but it is not the case the important thing is this and well as I told you to restore the original Jump we have the n which is when the collision ends and it was what we did here to avoid it being like that but well if you want it to stay in that jump for some strange level that you are doing perfectly you can duplicate this blueprint and not implement the one of the finish here the same thing you cast to the character that was the one that already finished the collision we obtain the character movement and we restore it Note that here it is a multiplication and here it is a division therefore if here the factor was 5 and the value of jun was 200 and here it was 1000 here what we do is when it comes out we reset it would be those 1000 that were left there between the factor that would be cco and it would give again 200 it is always good there to be careful to use values that do not have floating points or if it is a floating point that it is a fixed value so that you do not have problems there of that I do not know 200 33 333 then it starts to jump Then the factor is going to be 2003 33 it multiplies it by I dont know how much it would give a thousand and some points I dont know what and when it divides it the factor starts to change and with that the type of jump avoid that type of things but this is the solution that I found like that for the rest we establish it here at the jump velocity And that would be all a very simple platform to implement The important thing is that it is flexible as you can see well This is a box that later I have to adapt the animations and that but at the moment it restarts the level that would be the effect of killing there I have that little problem Sometimes it stays jumping a little bit I dont understand very well Why look at that here I think it is a problem with the editor here Note that initially when I jumped it was also short So there are times when something doesnt grab me well and here you can see here I left it five again that it works well Ah a detail that I had forgotten to tell you What is the delay that I placed here for At least for now I am handling it with that delay If I place it at zero I will see if I can do it since there are times when it starts to jump and simply stops jumping when it is in collision since here also in Johns we have one that indicates if We search for John you will see that there is one that we have or should be no sorry I think that here it did not come out it came out of the movement I am going to place jump we have several that said it was a bulano that said if it can jump or not Eh I dont see it Well I dont see it I think it was Isvins What happens is that you cannot always jump when you are in the air by default that is how the game comes by default or the level he can jump in certain rules that unfortunately I cannot see because I cannot see the source code or I do not know how to see it but that is a small problem since how he is jumping remains that he is jumping and precisely you will have there as if a race condition precisely when he collides with the surface that he should jump Maybe the character still not be prepared to jump and just stays there positioned on the platform Im going to see if I can simulate it here I put zero simulate it with this Here Im going to put The normal Jump that pain that always opens the one from Word here put one Im going to come here there you can see there it didnt jump well it should jump sometimes but its precisely because of that because there you can see Look at the difference Here Im walking and look that it jumps but from here on it doesnt jump anymore and when I enter jumping Notice that it doesnt jump anymore there is like a kind of race condition as I understand it in which as it is jumping and it is barely touching the surface that No the next jump is not available yet since again I am in the air I cant jump I give it several times to space and I only jump once it will only jump again when it collides with the floor that is to say when it is already in contact with the floor that is already handled internally which is unreal Although we can implement that but I say that it handles it internally because it is the one that I am using and that is how it is working therefore it is the problem that I had here and that is why I put a small delay so that precisely it gives time for that variable to be reestablished that indicates that it can jump again as I told you it was there but right now I cant find it and that is why I use this delay it is for simply that at the moment I put this factor of 005 but ah I would have to test it in real conditions if for example it has few fps how it works then I dont know if Ah I have to make some adaptation But at least for now I have it like that and thats all already with that I created the surface for the Jump So Ill see you in another video

- Andrés Cruz

En español

Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.

!Courses from!

10$

On Udemy

There are 2d 19:50!


Udemy

!Courses from!

4$

In Academy

View courses

!Books from!

1$

See the books
¡Become an affiliate on Gumroad!