So summing up: 1- Small Jumps: 0:21 2- Hang Time: 2:45 3- Jump Buffer: 5:50 4- Look Ahead: 10:23 5- Foot Dust: 16:00 This was REALLY REALLY helpful! Thank you so much!
@@gamesplusjames Will you continue the RPG series? Another thing: if you want to make a platformer, don't use colliders for the player controller: use raycasting.
I would recommend for everybody that use a ground verification every time on Update or FixedUpdate to stop the verification for the first 0.1s after the jump, because if you don't do that players can press multiple times and the ground check it's gonna return true because he not movemed enough to stop the ground check to return false; Another Tip: Remeber to set isGrounded to false and set de hangCount to 0 when you jump to avoid multiple jumps before the count gets to 0.
I'd recommend instead to handle rigid bodies, like changing velocity or checking ground, in fixed update. You can check for input in update, store it, and use it in FixedUpdate. That way you don't need any delay; by the time the next FixedUpdate comes, any changes you made have already been applied. Unity runs in this order: FixedUpdate, apply physics, collision callbacks, Update. But only update is guaranteed to run every frame, the other three can run multiple times per frame as part of the physics loop or not at all. If you think about it, it makes sense to avoid handling physics in Update; because you may miss things, or physics may not be updated yet. You can check things like ground in the collision callbacks, but you should avoid velocity changes, because they won't be applied until after the next FixedUpdate.
@@MaharbaRacsoChannel Yes, you're right but even in FixedUpdate we can get multiples jumps in one frame, since in one frame you apply the force and unless you're aplying an high force sometimes the body don't move enought before the next frame then you get unstable jumps heights, values that should't reset before the "real is grounded state" and thousands of others problems, best way to handle it is to just save the jump time and turn it on again 0.1s later, that's enought to solve any problems or you can set an small raycast line instead of big one but i don't recomend this since you can get another problems and most people use box check or circle...
I've never really posted a comment on RUclips, but I wanted to thank you for all the videos you've made over the years. This video helped me tremendously. I'll be buying a bunch of your courses later, for sure. Thank you for helping us pursue our passion!
Wow. You did so many things I saw explained for AAAGES in other tutorials with just a couple lines of code and even with better execution - it's amazing. Thank you!!
Also instead of making dust on input value you might want it to be on velocity.x, as when you move towards a wall and hit it it will continue to generate. Sometimes this might be desirable to show the player pushing stuff while drifting on the ground but in that case you might want a directional particle system so it will not generate in one place but show the opposite direction of pushing
Another very good tip is instead of just checking if the Player is grounded you should also check if he is not moving on the Y axis so he does not get his jump just back just by touching the side. Here is what I mean. Do: if (IsGrounded == true && Rb.velocity.y == 0) { hangTime = hangTimeValue; } Do not do: if (IsGrounded == true) { hangTime = hangTimeValue; }
Quick tip: for look ahead, use the rigidbody velocity instead of player input, since velocity takes wall collision into account, while GetAxisRaw doesn't. Cheers from france!
Very very cool tips; I started looking for the "small jumps" issue, and discover things I've never heard of, like the coyote jump. Thanks! It would be cool to keep publishing content like this. Great work!!!
Mind blown at how you make all of this perfectly clear 👌 Usually ppl do stuff and im scratching my head and I leave out absolutely boggled. Not u mate. Jump "king" bc this walk-thru is tops. Cheers.
for hangtime you might need to set hangtime to 0 on jump as people might exploit it to double jump * same for jumpbuffer as it might double jump if it's hitting a ground or something jumpable in that 0.1 sec
One more thing is to pay attention on small jumps as it might cause exploits later in case you have some boosters or things that push you up, player might use the space key to slow them down to have better precission on landing. So maybe just add a guard in that cases that user jumped from the ground or a booster
Firstly, I just want to say your tutorials are great. For anybody out there who wants to make a 2D platform game and like me has no experience, then I have to recommend his Udemy course, this RUclips tutorial makes a great following on point from what I've learned from you from Udemy. I have two quick questions; Q1) is there any way to add momentum to a player controller? I'd like it so the player does not always run at a fixed speed along the x axis, but builds up momentum over time, with a cap on how fast the top speed is. Also, I'd also like to be able to add the ability to crouch. I know that Brackeys covers crouching in one of his tutorials. However, he uses a pre-written script, but I like the way you break it down for beginners what each line of code is doing. I'm not knocking Brackeys, because his tutorials are also amazing too.
Super handy tips. Guess somebody has been reading up on Celeste dev blogs and stuff ;D I usually do two things differently though -For jumping I have a 'light' gravity (1 for example) for when the player is traveling up and holding the button, and a 'heavy' gravity (2.5 or something) for when he is going down, or still up but has just released the jump button. Seems to work pretty much the same as your though :d -I usually tie foot-dust to animation events. That way I can time the particles (or maybe even some animated sprites) with the steps perfectly, and also do a footstep sound and maybe other stuff all in a single 'step' function on the player somewhere :)
I was stuck trying to play particles when my character runs for like hours, and then i saw your comment and tried to play it using animation events and it worked flawlessly 😭 thanks!!
15:25 . for some reason when moving right my camera goes too, but when i move left my camera doesnt go left but right. yet the camtarget child does go left and right accordingly, i can see that via plus and minus position. but my camera doesnt go left when child goes. anyone help please? i really dont know fix
Maybe this is a silly question, but what's going on with groundCheckPoint2? Like, it makes sense for the first one to be placed at the player's feet to detect the ground, but where is the second one being placed?
Great video! I tried implementing the jump buffer into my game and, while it worked, all of the jumps that I buffered were at the maximum height and weren't affected by the variable jump height I also got from this video. I know why this is, but I don't know how to solve the problem. Can someone help me please?
Awesome tips and really really helpful! I am developing a Halloween platformer game right now for this month and I will also upload it on my Channel.🎃 I just implemented the hangtime and found a little problem...When jumping from the ground and if you manage to press the jumo button again before teh hangcounter is < 0, you actually manage to make a double jump. This happens because we no longer check if ew are grounded in order to perform a jump.🤨 I am working on this right now and I will comment here again if a solution is found! Thanks for the video bro😀
dunno if you figured it out yet, but setting a simple bool such as jumpBufferActivated to true when it should be active and false when the jump has been made or the timer ran out should be the fix there
I used your horizontal movement script and for some reason after jumping with my character, some kind of invisible border spawns where my player won't move in that direction anymore
Awesome video as usual James. I've got a question about the jumping before player touch ground... would it be good to do it by calculating the distance between the player and the ground and making it possible to jump if distance >, let's say, 0.5f? (just as an example. If we calculate the distance from a child object on the player that's positioned at the player's feet that should make it so that it would ignore "side" ground if you have platforms on the sides but still get the ground below. As I write this I'm also thinking... is it possible to just calculate the "down" distance in the vector2 (like.. vector2.down) related to a "general" object as it could be the tilemap?
You could certainly do that, but it would be a lot more complicated managing raycasts. Remember what your trying to achieve is not just checking if the player character is close to the ground, you are making it so that if the player presses a button slightly too early that you dont miss the input. You want that to be consistent and if for example your player was falling very fast, that window of being able to press early would become a lot shorter if you were simply checking the distance to the ground :)
For the camera movement why not use the cinemachine camera? It's built into Unity and does all that stuff with sliders that are much easier to understand and no coding needed.
hello bro :) im join your 2 udemy course.you doing awesome works there .and this video also informative and helpful thank for that.please keep your awesome work and have a wonderful day
Please help. I was following the first step and got the jumping in alright and it works. But for some reason my player passes through the platform above it when it does the larger jump (doesnt do it on the lower jump though). It looks like it turns off the Box Collider 2D on my player. I'm new to coding so I dont really know what the matter is. Any help would be greatly appreciated 😂
Think I've managed to fix the problem, however I have been struggling with the last step (the impact particle effect). I've watched through the video 10 times now and dont know a fix :/
When i set up the footsteps effect the same as you have yours, i still cant see the effects when i play the game. you can kinda see them but they are soooo small you cant really see them at all
What does isGround do? i need change it but don't know what i type there. Can you please help. I have differend name for it, u have isGrounded and i have xxx...?
Merhaba farkli bir konu hakkin da soru sormak isterim. Tilemap kullaniyorum ground check icin de ray yolluyorum sorun yok one way effector kullandigim da ve zipladigim da effectora degdigi icin ayakta ki ray ground algiliyor ve birden fazla zipliyor karakter nasil cozebilirim
Hi, Great Tutorial. I like to ask because I am stuck implementing the Small Jump, Hang Time, and Jump Buffer. But when I implement Jump Buffer the Small Jump Logic Broke. This is just an example for testing if you set Jump Buffer TIme to for example 1 sec then you press rapidly. when the jump executed it will always equal to jump force and you can't do a small jump. Can I ask how can I fix that because I am stuck in the logic of how can I implement those two together. Thank you in advance
I'm trying to create a 2D platformer for a school project. I recreated this code but the jump doesn't work. Is there another, separate character controller? Do I have to pay for the programming course to access it?
Everythin' is perfect dude, thx for video but; how can i get the other scripts like "CameraController" ? 'cause for example in fourth option, we need to drag the "Cam Target" to CameraController script which inside of the camera, and I don't have that script.
I want to make comment for tip 2 : I did that tip in my game as in video but if player presses multiple times to jump button, character could jump multiple times as well. Here is the solution: public float hangTime=.2f; public float hangCounter; public bool isJumped=false; public float isJumpedTime=.3f; public float isJumpedCounter; public bool isEqual; private void FixedUpdate() { if (isGrounded) { hangCounter = hangTime; } if (!isgrounded) { hangCounter -= Time.deltaTime; } if (isJumped && isEqual) { isJumpedCounter = isJumpedTime; isEqual = true; } if (isJumped) { isJumpedCounter -= Time.deltaTime; } if (isJumpedCounter 0 && !isJumped) { rbb.AddForce(Vector2.up * player.jumpf);
When introducing ideas like hangcounters and other checks, is there any chance that any kind of input lag could be introduced (as the game checks all of these values before determining the next course of action)?
Remember, all of these things are done within 1 frame before it loads so there wouldn't be any input lag. Usually with things as small as these, there shouldn't be any frame lag.
I am using the new input system and invoking my jump with unity events. I can't for the life of me figure out how to implement jump buffering in this way. Every single tutorial uses the old input system. Can someone PLEASE help!
A lot of people do that and it works great. Some people like creating a Movement() function separately just to keep things tidy and contained in their own little area. All about preference though!
@@gluedtogames he is talking about FixedUpdate() vs Update(). You should do all physics (such as rigidbody stuff) in FixedUpdate. The annoying part is that you sohuld get Input in Update(). The video is great but I would have loved to see this tutorial show an ellegant version to do it right.
id understand tha logic behind your code in buffer jump. If i'm not use jump the value of JumpBufferCount will be - Time. deltaTime. But is wrong becouse if i don't jump the value will be -infinite
Hello i`m having problems with number 4. Please help if possible. My playercontroller scripts flips the player like this. private void Flip() { if (canMove) { facingDirection *= -1; isFacingRight = !isFacingRight; transform.Rotate(0.0f, 180.0f, 0.0f); } } so when i use the following code, the camera wont go to left when going in that direction, it will only go right, if(Input.GetAxisRaw("Horizontal") >= 0) { cameraCheck.localPosition = new Vector3(Mathf.Lerp(cameraCheck.localPosition.x, aheadAmount * Input.GetAxisRaw("Horizontal"), aheadSpeed * Time.deltaTime), cameraCheck.localPosition.y, cameraCheck.localPosition.z);
Could you do a indepth tutorial on making a a game feel more impactful and "actiony". I have a platformer shooter..and i tried to add the basic game feel tips. But it still feels dull to play.
I have your udemy course 2d platformer fox tale i have several character sprite in the course there has a fox character i want have a character select menu there is any tips for that
Great video man, small pet peeve but there are a lot of lip smacking videos that feel weird in my ear. Might want to look at the gain or have some water on hand.
So summing up:
1- Small Jumps: 0:21
2- Hang Time: 2:45
3- Jump Buffer: 5:50
4- Look Ahead: 10:23
5- Foot Dust: 16:00
This was REALLY REALLY helpful! Thank you so much!
Thanks
Thanks, past me
Cool tips man, foot dust sounds so weird lol :D
Thanks man, if was either gonna be foot dust or toe flakes, I think I went with the right one :D
@@gamesplusjames Will you continue the RPG series? Another thing: if you want to make a platformer, don't use colliders for the player controller: use raycasting.
bruh dani
Yes daddy dani
The milkman is everywhere🥛
0:21 Small Jumps
2:46 Coyote Time
5:50 Jump Buffer
10:23 Look Ahead
15:59 Foot Dust
I would recommend for everybody that use a ground verification every time on Update or FixedUpdate to stop the verification for the first 0.1s after the jump, because if you don't do that players can press multiple times and the ground check it's gonna return true because he not movemed enough to stop the ground check to return false;
Another Tip:
Remeber to set isGrounded to false and set de hangCount to 0 when you jump to avoid multiple jumps before the count gets to 0.
Thanks for this comment, mate. I was having this exact issue earlier.
I'd recommend instead to handle rigid bodies, like changing velocity or checking ground, in fixed update. You can check for input in update, store it, and use it in FixedUpdate. That way you don't need any delay; by the time the next FixedUpdate comes, any changes you made have already been applied.
Unity runs in this order: FixedUpdate, apply physics, collision callbacks, Update. But only update is guaranteed to run every frame, the other three can run multiple times per frame as part of the physics loop or not at all.
If you think about it, it makes sense to avoid handling physics in Update; because you may miss things, or physics may not be updated yet. You can check things like ground in the collision callbacks, but you should avoid velocity changes, because they won't be applied until after the next FixedUpdate.
@@adscomics lol who i found here Hi
@@nagybalint1474 Hey-o!
@@MaharbaRacsoChannel Yes, you're right but even in FixedUpdate we can get multiples jumps in one frame, since in one frame you apply the force and unless you're aplying an high force sometimes the body don't move enought before the next frame then you get unstable jumps heights, values that should't reset before the "real is grounded state" and thousands of others problems, best way to handle it is to just save the jump time and turn it on again 0.1s later, that's enought to solve any problems or you can set an small raycast line instead of big one but i don't recomend this since you can get another problems and most people use box check or circle...
I've never really posted a comment on RUclips, but I wanted to thank you for all the videos you've made over the years. This video helped me tremendously. I'll be buying a bunch of your courses later, for sure.
Thank you for helping us pursue our passion!
Thank YOU for watching! :)
Wow. You did so many things I saw explained for AAAGES in other tutorials with just a couple lines of code and even with better execution - it's amazing. Thank you!!
Also instead of making dust on input value you might want it to be on velocity.x, as when you move towards a wall and hit it it will continue to generate. Sometimes this might be desirable to show the player pushing stuff while drifting on the ground but in that case you might want a directional particle system so it will not generate in one place but show the opposite direction of pushing
i liked the number 4 at 15:00 specialy the cam target script. I can use it for shake.
landing on 23:00 very cool.
Another very good tip is instead of just checking if the Player is grounded you should also check if he is not moving on the Y axis so he does not get his jump just back just by touching the side.
Here is what I mean.
Do:
if (IsGrounded == true && Rb.velocity.y == 0)
{
hangTime = hangTimeValue;
}
Do not do:
if (IsGrounded == true)
{
hangTime = hangTimeValue;
}
This was a nice touch to keep the double-jump from happening if you spam the key at the beginning of the jump because of hangTime. Thanks!
@@apexxcode2197 Glad that I could help
Yeah but the code doesn’t work when going up slopes
I love this style of videos. They have solid knowledge, and they tell you without trash talk.
Oh man, I finished your Udemy course recently. Love the way you explain things. Great tips and pleasant voice.
No homo
These tips are gold. I was thinking from quite some time that how will I do jump buffer, hang time and jump velocity. Thank you. You got a sub.
Quick tip: for look ahead, use the rigidbody velocity instead of player input, since velocity takes wall collision into account, while GetAxisRaw doesn't. Cheers from france!
thank you!
@@5Freerunner5 yw
Thank you so much for your tutorials, I just purchased your course "Learn To Code By Making a 2D Platformer in Unity & C#
"
I hope you enjoy the course!
@@gamesplusjames ive been going through your tutorial for making an old style rpg :)
link to course?
@@radikalbeats www.udemy.com/course/unityplatformer/
worked like a charm in 3D!
This is pure GOLD!
Very very cool tips; I started looking for the "small jumps" issue, and discover things I've never heard of, like the coyote jump.
Thanks! It would be cool to keep publishing content like this.
Great work!!!
4 minutes in and I'm already amazed, sooo good content. I appretiate it a lot, thank you man!
Mind blown at how you make all of this perfectly clear 👌
Usually ppl do stuff and im scratching my head and I leave out absolutely boggled. Not u mate.
Jump "king" bc this walk-thru is tops. Cheers.
Thanks for sharing these tips.
I don't see myself coding it the same way, but they are pretty clever directions toward which to go.
This tutorial is so useful I spent like a day implementing each one
dude you have helped me SOOO much through your youtube videos and udemy courses. THANKYOU !
Thanks for the last tip
It really helps make your character feel like a part of the world :)
for hangtime you might need to set hangtime to 0 on jump as people might exploit it to double jump
* same for jumpbuffer as it might double jump if it's hitting a ground or something jumpable in that 0.1 sec
One more thing is to pay attention on small jumps as it might cause exploits later in case you have some boosters or things that push you up, player might use the space key to slow them down to have better precission on landing. So maybe just add a guard in that cases that user jumped from the ground or a booster
this video is 100% priceless!! so easy to implement to my own code and it does make a great difference, u got a sub!
I’d like a series about putting work into a camera system
Kaiser9321 yes me too!
U can download free assets
For camera shake and camera follow
@@noellekkar903 you cant just joink everything and call yourself a PrGrAmMeR
this video really helped polish my game further. THANK YOU SO MUCH!
Nice one James! Can't wait to incorporate all these on my game!
Like you had a peek into my brain
Thanks a lot dude for thats presentation
Firstly, I just want to say your tutorials are great. For anybody out there who wants to make a 2D platform game and like me has no experience, then I have to recommend his Udemy course, this RUclips tutorial makes a great following on point from what I've learned from you from Udemy.
I have two quick questions;
Q1) is there any way to add momentum to a player controller? I'd like it so the player does not always run at a fixed speed along the x axis, but builds up momentum over time, with a cap on how fast the top speed is.
Also, I'd also like to be able to add the ability to crouch. I know that Brackeys covers crouching in one of his tutorials. However, he uses a pre-written script, but I like the way you break it down for beginners what each line of code is doing. I'm not knocking Brackeys, because his tutorials are also amazing too.
Super handy tips. Guess somebody has been reading up on Celeste dev blogs and stuff ;D
I usually do two things differently though
-For jumping I have a 'light' gravity (1 for example) for when the player is traveling up and holding the button, and a 'heavy' gravity (2.5 or something) for when he is going down, or still up but has just released the jump button. Seems to work pretty much the same as your though :d
-I usually tie foot-dust to animation events. That way I can time the particles (or maybe even some animated sprites) with the steps perfectly, and also do a footstep sound and maybe other stuff all in a single 'step' function on the player somewhere :)
Nice! That's an interesting way to achieve the same effect
I was stuck trying to play particles when my character runs for like hours, and then i saw your comment and tried to play it using animation events and it worked flawlessly 😭 thanks!!
15:25 . for some reason when moving right my camera goes too, but when i move left my camera doesnt go left but right.
yet the camtarget child does go left and right accordingly, i can see that via plus and minus position.
but my camera doesnt go left when child goes. anyone help please? i really dont know fix
This is gold, man! Thanks a lot! Game Feel really improved
Maybe this is a silly question, but what's going on with groundCheckPoint2? Like, it makes sense for the first one to be placed at the player's feet to detect the ground, but where is the second one being placed?
This was so incredibly useful! Thank you so much!!
Great video! I tried implementing the jump buffer into my game and, while it worked, all of the jumps that I buffered were at the maximum height and weren't affected by the variable jump height I also got from this video. I know why this is, but I don't know how to solve the problem. Can someone help me please?
Really helpful! Thanks a lot bro
Amazing tutorial. It works with 3D characters!
Awesome tips and really really helpful! I am developing a Halloween platformer game right now for this month and I will also upload it on my Channel.🎃
I just implemented the hangtime and found a little problem...When jumping from the ground and if you manage to press the jumo button again before teh hangcounter is < 0, you actually manage to make a double jump. This happens because we no longer check if ew are grounded in order to perform a jump.🤨
I am working on this right now and I will comment here again if a solution is found! Thanks for the video bro😀
dunno if you figured it out yet, but setting a simple bool such as jumpBufferActivated to true when it should be active and false when the jump has been made or the timer ran out should be the fix there
@@amuzak9063 can u send the code pls
Gold tutorial thank you so much!
This is a very cool video, keep going!
Great work, great channel, thank you for your work and for making ours easier !
Thank you for the helpful tips here! I appreciate you, James.
is this the entire script or is there another for controlling jump momentum and all that?
fantastic stuff man, thank you very much!
Great video as always, James.
You are the best teacher on planet :)
Excellent small super tweaks:)
I used your horizontal movement script and for some reason after jumping with my character, some kind of invisible border spawns where my player won't move in that direction anymore
I have issue with camera ahead, Camera just moves on right side. I have different Camera script for following object, maybe that's the issue?
Awesome video as usual James.
I've got a question about the jumping before player touch ground... would it be good to do it by calculating the distance between the player and the ground and making it possible to jump if distance >, let's say, 0.5f? (just as an example. If we calculate the distance from a child object on the player that's positioned at the player's feet that should make it so that it would ignore "side" ground if you have platforms on the sides but still get the ground below.
As I write this I'm also thinking... is it possible to just calculate the "down" distance in the vector2 (like.. vector2.down) related to a "general" object as it could be the tilemap?
You could certainly do that, but it would be a lot more complicated managing raycasts. Remember what your trying to achieve is not just checking if the player character is close to the ground, you are making it so that if the player presses a button slightly too early that you dont miss the input. You want that to be consistent and if for example your player was falling very fast, that window of being able to press early would become a lot shorter if you were simply checking the distance to the ground :)
@@gamesplusjames I see. That makes sense. Thank you. I'll see you in the Jam :)
How can I add double jump to these mechanics? Been trying for 2 days now and can't seem to get everything to work together without causing issues.
For the camera movement why not use the cinemachine camera? It's built into Unity and does all that stuff with sliders that are much easier to understand and no coding needed.
i hate it xd
hello bro :) im join your 2 udemy course.you doing awesome works there .and this video also informative and helpful thank for that.please keep your awesome work and have a wonderful day
Please help. I was following the first step and got the jumping in alright and it works. But for some reason my player passes through the platform above it when it does the larger jump (doesnt do it on the lower jump though). It looks like it turns off the Box Collider 2D on my player. I'm new to coding so I dont really know what the matter is. Any help would be greatly appreciated 😂
Think I've managed to fix the problem, however I have been struggling with the last step (the impact particle effect). I've watched through the video 10 times now and dont know a fix :/
When i set up the footsteps effect the same as you have yours, i still cant see the effects when i play the game. you can kinda see them but they are soooo small you cant really see them at all
Can we use cinemachine for the look ahead?
Great job! Very useful tips!
nice video, though you can make look ahead camera much easier with cinemachine
What does isGround do? i need change it but don't know what i type there. Can you please help. I have differend name for it, u have isGrounded and i have xxx...?
Merhaba farkli bir konu hakkin da soru sormak isterim. Tilemap kullaniyorum ground check icin de ray yolluyorum sorun yok one way effector kullandigim da ve zipladigim da effectora degdigi icin ayakta ki ray ground algiliyor ve birden fazla zipliyor karakter nasil cozebilirim
Great tips man, thanks
Hi, Great Tutorial.
I like to ask because I am stuck implementing the Small Jump, Hang Time, and Jump Buffer. But when I implement Jump Buffer the Small Jump Logic Broke.
This is just an example for testing if you set Jump Buffer TIme to for example 1 sec then you press rapidly. when the jump executed it will always equal to jump force and you can't do a small jump. Can I ask how can I fix that because I am stuck in the logic of how can I implement those two together. Thank you in advance
I'm trying to create a 2D platformer for a school project. I recreated this code but the jump doesn't work. Is there another, separate character controller? Do I have to pay for the programming course to access it?
thanks , it was very helpful
When i tried to do coyote time it worked but it also added my game to double jump how can i fix it
How are you doing the parallax in the background? Do you have a good video tutorial on that?
Everythin' is perfect dude, thx for video but; how can i get the other scripts like "CameraController" ? 'cause for example in fourth option, we need to drag the "Cam Target" to CameraController script which inside of the camera, and I don't have that script.
Just use Cinemachine bro
I want to make comment for tip 2 :
I did that tip in my game as in video but if player presses multiple times to jump button, character could jump multiple times as well. Here is the solution:
public float hangTime=.2f;
public float hangCounter;
public bool isJumped=false;
public float isJumpedTime=.3f;
public float isJumpedCounter;
public bool isEqual;
private void FixedUpdate()
{
if (isGrounded)
{
hangCounter = hangTime;
}
if (!isgrounded)
{
hangCounter -= Time.deltaTime;
}
if (isJumped && isEqual)
{
isJumpedCounter = isJumpedTime;
isEqual = true;
}
if (isJumped)
{
isJumpedCounter -= Time.deltaTime;
}
if (isJumpedCounter 0 && !isJumped)
{
rbb.AddForce(Vector2.up * player.jumpf);
isJumped = true;
}
would of been nice if you showed more of how the particle was set up. still cannot see my particles
More videos like this please 👍
How do I get a spectrum and c64 loading type screen on unity?
also i would really appreciate it if you could share with us your simple camera script xd
When introducing ideas like hangcounters and other checks, is there any chance that any kind of input lag could be introduced (as the game checks all of these values before determining the next course of action)?
Remember, all of these things are done within 1 frame before it loads so there wouldn't be any input lag. Usually with things as small as these, there shouldn't be any frame lag.
I am using the new input system and invoking my jump with unity events. I can't for the life of me figure out how to implement jump buffering in this way. Every single tutorial uses the old input system. Can someone PLEASE help!
hi, is it okay to use update function for movement?
It sure is!
A lot of people do that and it works great. Some people like creating a Movement() function separately just to keep things tidy and contained in their own little area. All about preference though!
@@gluedtogames he is talking about FixedUpdate() vs Update(). You should do all physics (such as rigidbody stuff) in FixedUpdate. The annoying part is that you sohuld get Input in Update(). The video is great but I would have loved to see this tutorial show an ellegant version to do it right.
bro can you please tell me what gravity setting you use cause my character is floating like a cloud and maybe i can go from your settings :D
To fix the double jump problem:
// manage jump buffer
if(Input.GetButtonDown("Jump"))
{
jumpBufferCount = jumpBufferLength;
}
else
{
jumpBufferCount -= Time.deltaTime;
}
if(jumpBufferCount >= 0 && hangCounter > 0f)
{
// theRB.velocity.x means that we leave the x axis as it is
theRB.velocity = new Vector2(theRB.velocity.x, jumpForce);
jumpBufferCount = 0f;
}
if(Input.GetButtonUp("Jump") && theRB.velocity.y > 0f)
{
theRB.velocity = new Vector2(theRB.velocity.x, theRB.velocity.y * .5f);
hangCounter = 0f;
}
id understand tha logic behind your code in buffer jump. If i'm not use jump the value of JumpBufferCount will be - Time. deltaTime. But is wrong becouse if i don't jump the value will be -infinite
I don't know why but for me the impact effect doesn't work. It follows the player in the air like the foot dust and dosen't stay at the jump location.
That's because it's a child transform of the player! Use "transform.SetParent(null)" to un-child it!
@@beri4138 thank you! :)
Hello i`m having problems with number 4. Please help if possible.
My playercontroller scripts flips the player like this.
private void Flip()
{
if (canMove)
{
facingDirection *= -1;
isFacingRight = !isFacingRight;
transform.Rotate(0.0f, 180.0f, 0.0f);
}
}
so when i use the following code, the camera wont go to left when going in that direction, it will only go right,
if(Input.GetAxisRaw("Horizontal") >= 0)
{
cameraCheck.localPosition = new Vector3(Mathf.Lerp(cameraCheck.localPosition.x, aheadAmount * Input.GetAxisRaw("Horizontal"), aheadSpeed * Time.deltaTime), cameraCheck.localPosition.y, cameraCheck.localPosition.z);
Mr gamesplusjames, would you mind sending me your camera script? that would be very helpful! Great videos, you just got a new subscriber :)
If I where you I would just use Cinemachine for the camera :) no need to code that urself
Could you do a indepth tutorial on making a a game feel more impactful and "actiony". I have a platformer shooter..and i tried to add the basic game feel tips. But it still feels dull to play.
Adding screenshake is a handy way to do this, which you can find a tutorial on at ruclips.net/video/8PXPyyVu_6I/видео.html
I was wondering if it would be okay if I did a similar video but with gdscript in Godot?
Very good video thanks for the ideas :D
Thanks for watching!
what asset pack are you using for that background and foreground?
I have your udemy course 2d platformer fox tale i have several character sprite in the course there has a fox character i want have a character select menu there is any tips for that
how we can do double jump with this codes;
What's with all the overlay ADs????
very helpful, thanks
Can you make a Tutorial for the Camera Script ?
Awesome tutorial :)
I was looking for copper, and I found good!
Thank you sooo much
Thanks so
much 😀😀😀😀
Bro how to create a basic 2.5d game in unity full tutorials.pls upload the video i want to make 2.5d
Great video man, small pet peeve but there are a lot of lip smacking videos that feel weird in my ear. Might want to look at the gain or have some water on hand.
Very helpful sir
Glad I can help a little :)
Thank you!!
Great video!!
Can you make full game like super mario😮