Thank god, I found this video. Every time I try the player can jump midair when I use tilemaps. Now when I try this method it worked. He isn't jumping in the air anymore.
tysm for this tutorial, in december i wanted to make a 2d platformer but i didnt know how to start, this tutorial helped me build the base of the game and im still developing it to this day and learning how unity works
Thank you very much for this tutorial. Especially how you explain why you had done certain actions and ext. Many videos just click and do things without much explanation as to the why. Helped very much!!!!!
Thanks dude, learning C# and unity right now and this taught me a lot of features in unity I had no Idea about, saved me a lot of time from looking through unity’s documentation lol
The code does work for it's main jump functionality, though it comes at a cost of making your player a professional wall jumper, so i honestly recommend another line of code.
yoooo thank you so much i fucken love I've been trying to figure this out for a long time i watched your video did exactly what u said and it fucken worked I'm understanding the concepts a little I didn't want to dopy and paste the code I watched and listened thank you so much....again thank you sooo much you didn't ask to join a discord or ask for money yours actually passing down knowledge thank you
thank you so much. this helped me out so much. im trying to learn unity myself. but this isnt information overload and easy to understand. thank you man
Sorry for being late, you'd basically have to make it so doing your Jump function is tied to a condition testing whether a variable (jumpAmount) is > 0, with the jumpAmount being reset upon colliding with ground (setting it to something like maxJumps) and just making jumpAmount count down 1 everytime you run Jump. Should be foolproof as you're always expecting Jump to have some kind of Y effect, so there'll always be an OnCollisionEnter with ground to reset Jump else but you could tie the jumpAmount refreshing to always reset on a timer when a boolean is set to true OnCollisionEnter, which is then set to false when exitting, with this being if you REALLY want to make sure nothing goes wrong (aka if you make a perfect container that makes a jump yet doesn't exit collision).
Works great! One question I do have is that for the jump, is there a reason you would choose to code the isJumping functions rather than just checking to see if rb.velocity.y == 0?
Interesting question, I think Yes! There is always another way of doing things. Have you tried it? On another note, I didn't understand why we use 'oncollisionenter' and 'oncollisionexit' , my feeling is that can be simplified... Great vid tho! ;-)
the error says that it does not know what jump button is so im stuck can you help me plz also thanks for the video, it helpt other then the jump button.
why i get an error. 'Collision2D' does not contain a definition for 'gameOpject' and no accessible extension method 'gameOpject' accepting a first argument of type 'Collision2D' could be found.
Just wondering if there was something i missed in the code, because whenever i collide with something in the corner of my square, the player starts to spin like crazy. Is there a way to lock the rotation, im really new to unity and game dev. (Started this year)
Thanks for the tutorial, movement worked well but there is one problem that I can't fix. If I am touching a platform with the "floor" tag and then stop touching it but still am on the ground, I cannot jump anymore since I stopped colliding with a "Floor". Do you have a way to fix this?
It keeps coming up with the error Assets\Scripts\PlayerMovement.cs(25,63): error CS1002: ; expected What do I do This is just for the movement script btw
@@morebblakeyyy Hey tysm for the quick reply - i found out it was actually just the lack of a capital S in a variable, so i corrected that and boom - fixed :D
hey im getting stuck on the jumping code unity keeps giving me an error that says Assets\PlayerMovement.cs(30,7): error CS1513: } expected ive been trying to fix it for hours do you know what this means
@@morebblakeyyy Thank you so much for the help though i haven't found anyone as simple as you...the only problem that you have is not having enough tutorials in your channel😂 I Have Subbed already so i will be waiting for you mate
Hey blakey i just have a question. when i change the square placeholder to my player sprite i could still walk but i wasnt able to jump anymore. I was still able to walk but jumping wasnt possible anymore. I didnt change anything other then the collider if you could help me out it would be appreciated!
according to the code, you have to change the speed and the jump after you start the game because it set the jump value to the 0. private void Start() { speed = 5f; //you can change this value jump = 200; //you can change this value. } try adding this code into the movement script. Edit : Sorry if its too late to answer I just wanted you to know this xd
On collision seems more robust bc you can technically touch terrain where you aren't raycasting. Bc of this I always end up making like 8 raycasts around my player. Why isn't On Collision as good?
On collision works great, raycast is just more reliable when you only want to target the floor below you or a specific angle. It’s whatever works better for your game!
Bepedi bopity . Your code is now my property
Finally a simple and good way to check for ground thanks for the help mate
Thank you so much, I spent my too much time to following lots tutorials but no one works. This tutorial helped me.
When I tried your method for the first time the jump didn't work. But now after adding the jump power up to 200 it worked. Thank you!
SAME but ground check does not working still
Most of the simple tutorials don't work so I had low expectation for this one but it works!!!
Thank you for the video and thanks for not click baiting
Best 2d movement tutorial i've seen i've been around a lot and they're all complicated but this on is short and to the point
Thank god, I found this video. Every time I try the player can jump midair when I use tilemaps. Now when I try this method it worked. He isn't jumping in the air anymore.
After scouring the internet for hours looking for this solution, this tutorial is the only thing I found that actually worked.
tysm for this tutorial, in december i wanted to make a 2d platformer but i didnt know how to start, this tutorial helped me build the base of the game and im still developing it to this day and learning how unity works
Thanks I have been trying to figure this out for at least three days.
Thank you very much for this tutorial. Especially how you explain why you had done certain actions and ext. Many videos just click and do things without much explanation as to the why. Helped very much!!!!!
Thanks dude, learning C# and unity right now and this taught me a lot of features in unity I had no Idea about, saved me a lot of time from looking through unity’s documentation lol
The code does work for it's main jump functionality, though it comes at a cost of making your player a professional wall jumper, so i honestly recommend another line of code.
after trial and error this tutorial helped me thank goodness i almost gave up
knowledge rules everything around me!
only tutorial i found that actually explains the code you're writing and how it works n stuff - thank u !!
Thank you so much❤ it took me 6 hours to find a working tutorial xD
late to viewing, but love how you explain what the code does and is easy to follow!
Very well shown and explained 👍🏽
Thank you soooooo much for this you have no idea the trouble it saved me
finally i found a good tutorial
Thank You!!!!!!!!!!!!! this vid means more than you'll ever know
yoooo thank you so much i fucken love I've been trying to figure this out for a long time i watched your video did exactly what u said and it fucken worked I'm understanding the concepts a little I didn't want to dopy and paste the code I watched and listened thank you so much....again thank you sooo much you didn't ask to join a discord or ask for money yours actually passing down knowledge thank you
thank you bro, amazing!
thank you so much. this helped me out so much. im trying to learn unity myself. but this isnt information overload and easy to understand. thank you man
very helpful 👍
Thanks! Works in 2022, helped me a lot!
Glad to hear it! :)
Saving this one for a future project
Glad to hear it!
thank you man so much
my cube is just going right cool
Hey i tried everything but the jump didn't work can someone help me please? :(
Great!!
I have a problem, my Variables aren't showing up in Unity even though I save
and I get, Assets\PlayerMovement.cs(24,63): error CS1002: ; expected
you probably forgot a ";" at the end of the line
Your awesome thank you
I like the chapters!
I set up all the code correctly but it won’t move left and right when I press the keys and it won’t give me any errors
You re the best
Thank you for this tutorial. But what if I want to implement a double jump function?
Sorry for being late, you'd basically have to make it so doing your Jump function is tied to a condition testing whether a variable (jumpAmount) is > 0, with the jumpAmount being reset upon colliding with ground (setting it to something like maxJumps) and just making jumpAmount count down 1 everytime you run Jump.
Should be foolproof as you're always expecting Jump to have some kind of Y effect, so there'll always be an OnCollisionEnter with ground to reset Jump else but you could tie the jumpAmount refreshing to always reset on a timer when a boolean is set to true OnCollisionEnter, which is then set to false when exitting, with this being if you REALLY want to make sure nothing goes wrong (aka if you make a perfect container that makes a jump yet doesn't exit collision).
Thx bro! Can you show the "flip" method to?:D
thanks soo much
the script things that show under it dont show for me
Thanks!
what a real babe
Keep going , and thank you 😊
you're welcome :)
thank you so much!!!!!
error CS0246: The type or namespace name 'RigidBody' could not be found (are you missing a using directive or an assembly reference?)
Thanku so much bro ❤️❤️
No prob bro👌🏻
thank you
Awesome , But why did you suggested to use raycast for a long term project ?
Thank you
Very cool :)
Make sure to sub :)
Works great! One question I do have is that for the jump, is there a reason you would choose to code the isJumping functions rather than just checking to see if rb.velocity.y == 0?
Interesting question, I think Yes! There is always another way of doing things. Have you tried it?
On another note, I didn't understand why we use 'oncollisionenter' and 'oncollisionexit' , my feeling is that can be simplified...
Great vid tho! ;-)
This wouldn't work on slopes
How do you set up your Intellisense like that, mine isn't that suggestive
for me it just barley jumps and then when i increase the jump power it just teleports the square into the sky
thanks
the error says that it does not know what jump button is so im stuck can you help me plz
also thanks for the video, it helpt other then the jump button.
instead of Input.GetButtonDown("Jump") use Input.GetKeyDown(KeyCode.W) where KeyCode is the button you want to use to jump
i have the same thing the movement is working but the jump doesnt
it says the name other does not exist in this context how do i fix it?
why i get an error. 'Collision2D' does not contain a definition for 'gameOpject' and no accessible extension method 'gameOpject' accepting a first argument of type 'Collision2D' could be found.
I just go straight up
Is there a way where I can make it so if you hold before reaching the ground,your jump is still registered as soon as you reach the ground
what should I do if the console says ArgumentException : input axis horizontal is not setup. after the first set of code
i did everything exactly the same but im still double jumping?
probs missed out the 2d at the end of the collision methods
Thank you very much! Can you please add crouch to that code please?
character speed, jump and rb is not showing up for me
Sorry but when i type my code, it doesnt come with the word colours and everything is perfect but it doesnt show the speed, jump functions in unity
You fix it or not because i know why that’s happening
@@kingdoom1906 nope
@@yungjetskimihara2 it might be an intellisense problem. Are you using visual studio?
The ground doesn’t work there are no errors and the code is the same pls help
When i type " Rigidbody2d" nothing shows up what should i do to fix that because every soliution i try dosent work.
There is a space between Rigid Body and 2d. Try searching "rigidbody 2d".
@@capncrunchfan255 i tryed that but it didnt help but it worked anyways but thanks for the suggestion
It's intellisence follow my tutorial to fix it
ARAZI OLSUN
razı*
Just wondering if there was something i missed in the code, because whenever i collide with something in the corner of my square, the player starts to spin like crazy. Is there a way to lock the rotation, im really new to unity and game dev. (Started this year)
you can lock z movement on the rigidbody to the player in constrains
What is the version of your Microsoft visual studio?
raycasting is probs easier but cool vid anyways
i just want double jump how can i do this
It says the modifier private is not valid for the item? Please help
Thanks for the tutorial, movement worked well but there is one problem that I can't fix. If I am touching a platform with the "floor" tag and then stop touching it but still am on the ground, I cannot jump anymore since I stopped colliding with a "Floor". Do you have a way to fix this?
yes me to
help please
Script error: OnCollisionExit2D
This message parameter has to be of type: Collision2D
I doesnt show the variables in unity
It keeps coming up with the error
Assets\Scripts\PlayerMovement.cs(25,63): error CS1002: ; expected
What do I do
This is just for the movement script btw
Means ur missing a ; or it’s in the wrong place
Did you fix this yet, as I am having the same problem and my script is identical to that of the video...
@@Wolphen if you’re having that error it’s not identical, you’re missing a semi colon
@@morebblakeyyy Hey tysm for the quick reply - i found out it was actually just the lack of a capital S in a variable, so i corrected that and boom - fixed :D
@@Wolphen good stuff, make sure to sub!
your second channel has more subs than ur main
Indeed. Tutorials naturally do better then game development challenges and stuff so was planned.
every time i try this, it just says'arguament Exception: input jump buttton is not setup'
You have to rite Jump
Not jump
Ah buzzin, it's mad how some of these problems are easy when shown how haha.
nice one
rakhmet man
will you create a tutorial for 2Dcharacter attacks?
Yeah sure
I don't understand the 4:52 part
hey im getting stuck on the jumping code unity keeps giving me an error that says Assets\PlayerMovement.cs(30,7): error CS1513: } expected ive been trying to fix it for hours do you know what this means
You’re missing a } on line 30
@@bblakeyyy thanks
this and evey other unity 2d tutorial movement tutorial dosent work for me
what language do u use for the programming?
C#
what is key for jump?
i think space?
its not working bc player movement speed jump wont show up :(
mee too
If "Input.GetAxis("Horizontal");" is the old method what is the new one?
It’s a whole new input system. I’m gonna do a video on it, as it’s a bit of a pain
@@morebblakeyyy Thank you so much for the help though i haven't found anyone as simple as you...the only problem that you have is not having enough tutorials in your channel😂
I Have Subbed already so i will be waiting for you mate
@@t.b.g158 no prob man! Appreciate that👌🏻
This didn't work I need help
um i try doing the tutorial 10 time and it is not working
whats wrong with it?
@@morebblakeyyy it keeps glitches and it would sometimes say it doesn’t have a class or error
i dont have the same in my unity promaiters help plz. 5:25
its been 9 months found any fix to it ?
how to fix (51,2): error CS1513: } expected
Send screenshots
Hey blakey i just have a question. when i change the square placeholder to my player sprite i could still walk but i wasnt able to jump anymore. I was still able to walk but jumping wasnt possible anymore. I didnt change anything other then the collider if you could help me out it would be appreciated!
according to the code, you have to change the speed and the jump after you start the game because it set the jump value to the 0.
private void Start()
{
speed = 5f; //you can change this value
jump = 200; //you can change this value.
}
try adding this code into the movement script.
Edit : Sorry if its too late to answer I just wanted you to know this xd
@@GodSpeed_0vO thanks!
On collision seems more robust bc you can technically touch terrain where you aren't raycasting. Bc of this I always end up making like 8 raycasts around my player.
Why isn't On Collision as good?
On collision works great, raycast is just more reliable when you only want to target the floor below you or a specific angle.
It’s whatever works better for your game!
@@morebblakeyyy ok thanks
The stupid menu didn't show up so i cant make it function (but youre a pro its eazy af and you have money)
What lol
@@morebblakeyyy im sorry but my little brother tryed unity And He just raged So this happend
You are amazing
thank you very much
dosnt work
Does still work currently. Double check your code, editor setup, etc
@@bblakeyyy Cannot get it to work any longer either with newest Unity Update.
@@Jake7i What's your issue
Player movement doesn't work at all
What’s not working?
@@glass_eater11 well that was a long time ago and from what i remember i abandoned that project but it was propably just my fault
I won't let me jump
Same here
majka umrla