Unity 2D Player Move and Jump with Groundcheck Tutorial

  Рет қаралды 44,244

MoreBBlakeyyy

MoreBBlakeyyy

Күн бұрын

More videos coming soon!
Intro 00:00
Setup 00:22
Creating Variables 03:12
Move function 03:58
Jump function 05:56
Inspector 06:33
Ground Check 07:20
Outro 10:44
Main Channel: / bblakeyyy
Patreon with fully explained c# scripts:
/ blakeygames
NEW SERVER LINK: / discord
Silhouette Dash free download:
blakey-games.itch.io/silhouet...
Join the discord community!:
/ discord
Play my games! :
blakey-games.itch.io/
play.google.com/store/apps/de...
Watch me Live on twitch: / bblakeyyy
My Website!: bblakeygames.wixsite.com/blak... Audio used in my videos:
♪ Onion (Prod. by Lukrembo)
Link : • (no copyright music) l...
♪ Branch (Prod. by Lukrembo)
Link : • (no copyright music) c...
♪ Biscuit (Prod. by Lukrembo)
Link : • (no copyright music) l...
♪ Bread (Prod. by Lukrembo)
Link : • (no copyright music) j...

Пікірлер: 161
@sleepyboi5739
@sleepyboi5739 Жыл бұрын
Bepedi bopity . Your code is now my property
@GaganKumar-fz6wz
@GaganKumar-fz6wz 11 ай бұрын
Thank you so much, I spent my too much time to following lots tutorials but no one works. This tutorial helped me.
@apcrothon6047
@apcrothon6047 Жыл бұрын
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!!!!!
@foros9548
@foros9548 9 ай бұрын
Finally a simple and good way to check for ground thanks for the help mate
@DougBoy791
@DougBoy791 5 ай бұрын
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
@Boogie-wi7hd
@Boogie-wi7hd Жыл бұрын
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
@glowingshard-bfdi
@glowingshard-bfdi 2 ай бұрын
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
@draftdimension9079
@draftdimension9079 Жыл бұрын
Thanks I have been trying to figure this out for at least three days.
@painithin
@painithin 7 ай бұрын
Very well shown and explained 👍🏽
@ITYWTD_
@ITYWTD_ 9 күн бұрын
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
@mrdragon7769
@mrdragon7769 11 ай бұрын
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!
@griff424
@griff424 10 ай бұрын
SAME but ground check does not working still
@RavDeBest
@RavDeBest 9 ай бұрын
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.
@Real_Wollus
@Real_Wollus 24 күн бұрын
Thank you so much❤ it took me 6 hours to find a working tutorial xD
@editsforevery1
@editsforevery1 2 ай бұрын
thank you bro, amazing!
@matthewwilliamsvideos
@matthewwilliamsvideos Ай бұрын
Thank you soooooo much for this you have no idea the trouble it saved me
@altertonart1085
@altertonart1085 Ай бұрын
late to viewing, but love how you explain what the code does and is easy to follow!
@tbl7608
@tbl7608 Жыл бұрын
yay, it worked If you are having problem with the player moving, try to make the Move float public and add some number to it :)
@morebblakeyyy
@morebblakeyyy Жыл бұрын
You’re move float is accessed by your input every frame, so I don’t think this will make a difference, you likely did something else that fixed whatever issue you was having :D
@donalbrennan7289
@donalbrennan7289 Жыл бұрын
only tutorial i found that actually explains the code you're writing and how it works n stuff - thank u !!
@senecatheweeb1604
@senecatheweeb1604 2 ай бұрын
Thank You!!!!!!!!!!!!! this vid means more than you'll ever know
@coolname2709
@coolname2709 Жыл бұрын
finally i found a good tutorial
@tiemlee723
@tiemlee723 Жыл бұрын
Thank you so much because it working
@atonyrodelo
@atonyrodelo 8 ай бұрын
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
@BabuWasHere
@BabuWasHere 6 ай бұрын
very helpful 👍
@FoodNomsNoms
@FoodNomsNoms 2 жыл бұрын
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
@145Jamie
@145Jamie 8 ай бұрын
How do you set up your Intellisense like that, mine isn't that suggestive
@Osoclevergames
@Osoclevergames Ай бұрын
Your awesome thank you
@yahyagd5637
@yahyagd5637 10 күн бұрын
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
@justusisbestest4122
@justusisbestest4122 Жыл бұрын
thank you so much!!!!!
@neozoid7009
@neozoid7009 Жыл бұрын
Awesome , But why did you suggested to use raycast for a long term project ?
@aenathemas9596
@aenathemas9596 Жыл бұрын
Great!!
@toonztheunknown6164
@toonztheunknown6164 11 ай бұрын
what should I do if the console says ArgumentException : input axis horizontal is not setup. after the first set of code
@NatronBlood
@NatronBlood 2 жыл бұрын
knowledge rules everything around me!
@anjaneshpal8825
@anjaneshpal8825 7 ай бұрын
thank you
@sumdeathjr
@sumdeathjr Жыл бұрын
error CS0246: The type or namespace name 'RigidBody' could not be found (are you missing a using directive or an assembly reference?)
@Wesleygoodboy
@Wesleygoodboy Жыл бұрын
What is the version of your Microsoft visual studio?
@guyturtle8927
@guyturtle8927 6 ай бұрын
Hey i tried everything but the jump didn't work can someone help me please? :(
@sonny_days2751
@sonny_days2751 11 ай бұрын
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
@69420bet
@69420bet Жыл бұрын
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.
@wasabihulk4731
@wasabihulk4731 2 жыл бұрын
it says the name other does not exist in this context how do i fix it?
@oivariini7
@oivariini7 Жыл бұрын
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?
@oliviercote9360
@oliviercote9360 Жыл бұрын
yes me to
@srogue112
@srogue112 11 ай бұрын
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?
@JakeSimmer
@JakeSimmer 10 ай бұрын
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! ;-)
@thenacho6354
@thenacho6354 13 күн бұрын
This wouldn't work on slopes
@BassJunkeeZ
@BassJunkeeZ Жыл бұрын
thanks
@coonstar
@coonstar 9 ай бұрын
It says the modifier private is not valid for the item? Please help
@Jihmark
@Jihmark Жыл бұрын
Thank you for this tutorial. But what if I want to implement a double jump function?
@averageviewer8511
@averageviewer8511 7 ай бұрын
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).
@yoav_tc
@yoav_tc 2 жыл бұрын
Thanks! Works in 2022, helped me a lot!
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
Glad to hear it! :)
@ekoproductions.1949
@ekoproductions.1949 Жыл бұрын
help please Script error: OnCollisionExit2D This message parameter has to be of type: Collision2D
@csabaszabo2189
@csabaszabo2189 11 ай бұрын
Thx bro! Can you show the "flip" method to?:D
@bumberto_eko1068
@bumberto_eko1068 2 жыл бұрын
my cube is just going right cool
@bazzer360
@bazzer360 2 жыл бұрын
Saving this one for a future project
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
Glad to hear it!
@AmogusSussy69
@AmogusSussy69 11 ай бұрын
how to make a double jump function pls answer :D
@joaoi.9920
@joaoi.9920 Ай бұрын
You re the best
@isimsizanimator1291
@isimsizanimator1291 11 ай бұрын
i just want double jump how can i do this
@bogm5801
@bogm5801 Жыл бұрын
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
@grasmously9610
@grasmously9610 5 ай бұрын
you probably forgot a ";" at the end of the line
@mechxp2008
@mechxp2008 Жыл бұрын
character speed, jump and rb is not showing up for me
@lehmspielt
@lehmspielt Жыл бұрын
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!
@OmenRant
@OmenRant Жыл бұрын
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
@lehmspielt
@lehmspielt Жыл бұрын
@@OmenRant thanks!
@pffguy133
@pffguy133 Жыл бұрын
The ground doesn’t work there are no errors and the code is the same pls help
@betsydillard3857
@betsydillard3857 2 жыл бұрын
I like the chapters!
@MusicMagic700
@MusicMagic700 2 жыл бұрын
Keep going , and thank you 😊
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
you're welcome :)
@fglobal853
@fglobal853 10 ай бұрын
Thank you very much! Can you please add crouch to that code please?
@progaming915
@progaming915 Жыл бұрын
what language do u use for the programming?
@guyturtle8927
@guyturtle8927 6 ай бұрын
C#
@swasdefguv
@swasdefguv Жыл бұрын
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
@bblakeyyy
@bblakeyyy Жыл бұрын
You’re missing a } on line 30
@swasdefguv
@swasdefguv Жыл бұрын
@@bblakeyyy thanks
@DeadlyInsaan
@DeadlyInsaan 2 жыл бұрын
Thanks!
@smucsaurzs
@smucsaurzs 2 ай бұрын
the script things that show under it dont show for me
@sachinkankane9877
@sachinkankane9877 2 жыл бұрын
Thanku so much bro ❤️❤️
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
No prob bro👌🏻
@tesfalemgaming
@tesfalemgaming Жыл бұрын
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.
@reliction
@reliction Жыл бұрын
instead of Input.GetButtonDown("Jump") use Input.GetKeyDown(KeyCode.W) where KeyCode is the button you want to use to jump
@nhatlinhphan4485
@nhatlinhphan4485 Ай бұрын
i have the same thing the movement is working but the jump doesnt
@PawelHerok
@PawelHerok 2 жыл бұрын
Thank you Very cool :)
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
Make sure to sub :)
@t.b.g158
@t.b.g158 2 жыл бұрын
If "Input.GetAxis("Horizontal");" is the old method what is the new one?
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
It’s a whole new input system. I’m gonna do a video on it, as it’s a bit of a pain
@t.b.g158
@t.b.g158 2 жыл бұрын
@@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
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
@@t.b.g158 no prob man! Appreciate that👌🏻
@TypekMD
@TypekMD 6 ай бұрын
I doesnt show the variables in unity
@xelber2935
@xelber2935 2 жыл бұрын
When i type " Rigidbody2d" nothing shows up what should i do to fix that because every soliution i try dosent work.
@capncrunchfan255
@capncrunchfan255 2 жыл бұрын
There is a space between Rigid Body and 2d. Try searching "rigidbody 2d".
@xelber2935
@xelber2935 2 жыл бұрын
@@capncrunchfan255 i tryed that but it didnt help but it worked anyways but thanks for the suggestion
@musakeys5600
@musakeys5600 Жыл бұрын
It's intellisence follow my tutorial to fix it
@Raptishy
@Raptishy Жыл бұрын
I just go straight up
@xDTHECHEMISTx
@xDTHECHEMISTx 2 жыл бұрын
will you create a tutorial for 2Dcharacter attacks?
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
Yeah sure
@yungjetskimihara2
@yungjetskimihara2 2 жыл бұрын
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
@kingdoom1906
@kingdoom1906 Жыл бұрын
You fix it or not because i know why that’s happening
@yungjetskimihara2
@yungjetskimihara2 Жыл бұрын
@@kingdoom1906 nope
@gachastorys5129
@gachastorys5129 Жыл бұрын
@@yungjetskimihara2 it might be an intellisense problem. Are you using visual studio?
@Fredrick-Gregory
@Fredrick-Gregory 2 жыл бұрын
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
@morebblakeyyy 2 жыл бұрын
Means ur missing a ; or it’s in the wrong place
@Wolphen
@Wolphen 2 жыл бұрын
Did you fix this yet, as I am having the same problem and my script is identical to that of the video...
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
@@Wolphen if you’re having that error it’s not identical, you’re missing a semi colon
@Wolphen
@Wolphen 2 жыл бұрын
@@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
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
@@Wolphen good stuff, make sure to sub!
@Dagoldenaxolottl7808
@Dagoldenaxolottl7808 6 ай бұрын
every time i try this, it just says'arguament Exception: input jump buttton is not setup'
@guyturtle8927
@guyturtle8927 6 ай бұрын
You have to rite Jump Not jump
@snabee5290
@snabee5290 Жыл бұрын
what a real babe
@oscardog2342
@oscardog2342 Жыл бұрын
this and evey other unity 2d tutorial movement tutorial dosent work for me
@anasfaidhy5674
@anasfaidhy5674 2 жыл бұрын
how to fix (51,2): error CS1513: } expected
@musakeys5600
@musakeys5600 Жыл бұрын
Send screenshots
@daffadziibaankhoiri1176
@daffadziibaankhoiri1176 Жыл бұрын
what is key for jump?
@nhatlinhphan4485
@nhatlinhphan4485 Ай бұрын
i think space?
@Padrrigg
@Padrrigg Жыл бұрын
I don't understand the 4:52 part
@forrester659
@forrester659 11 ай бұрын
ARAZI OLSUN
@forrester659
@forrester659 11 ай бұрын
razı*
@loboleigh7337
@loboleigh7337 2 жыл бұрын
its not working bc player movement speed jump wont show up :(
@user-gs3wo3oz2q
@user-gs3wo3oz2q Жыл бұрын
mee too
@highonowlmoist409
@highonowlmoist409 11 ай бұрын
i dont have the same in my unity promaiters help plz. 5:25
@manangrover2086
@manangrover2086 Ай бұрын
its been 9 months found any fix to it ?
@foxheals
@foxheals 2 жыл бұрын
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?
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
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!
@foxheals
@foxheals 2 жыл бұрын
@@morebblakeyyy ok thanks
@orionB08
@orionB08 2 жыл бұрын
The code is working pretty well but the 'Is Jumping' gets a tick automatically how can i fix it?
@musakeys5600
@musakeys5600 Жыл бұрын
Follow my tutorial
@alikaiyr6308
@alikaiyr6308 10 ай бұрын
rakhmet man
@TheGuyInTheHoddie
@TheGuyInTheHoddie 2 жыл бұрын
um i try doing the tutorial 10 time and it is not working
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
whats wrong with it?
@TheGuyInTheHoddie
@TheGuyInTheHoddie 2 жыл бұрын
@@morebblakeyyy it keeps glitches and it would sometimes say it doesn’t have a class or error
@DerriousDancer
@DerriousDancer 7 ай бұрын
This didn't work I need help
@rashedalqarni118
@rashedalqarni118 2 жыл бұрын
Is there code i can make it flip each side? Please
@musakeys5600
@musakeys5600 Жыл бұрын
Follow my tutorial
@LForce5241
@LForce5241 8 ай бұрын
I did everything you said but it does not work I don’t get any errors idk if this is fake or not
@SubToPlunga
@SubToPlunga 11 ай бұрын
your second channel has more subs than ur main
@morebblakeyyy
@morebblakeyyy 11 ай бұрын
Indeed. Tutorials naturally do better then game development challenges and stuff so was planned.
@adrianmeyer2157
@adrianmeyer2157 2 жыл бұрын
Ah buzzin, it's mad how some of these problems are easy when shown how haha.
@morebblakeyyy
@morebblakeyyy 2 жыл бұрын
nice one
@roachdoggjr1940
@roachdoggjr1940 Жыл бұрын
what the fuck? why is my bool always set to false? did unity change something?
@briosh.mp4
@briosh.mp4 11 ай бұрын
this dont work
@brockkenney6428
@brockkenney6428 Жыл бұрын
I won't let me jump
@guyturtle8927
@guyturtle8927 6 ай бұрын
Same here
@anti.zoo.soldier
@anti.zoo.soldier 6 ай бұрын
The stupid menu didn't show up so i cant make it function (but youre a pro its eazy af and you have money)
@morebblakeyyy
@morebblakeyyy 6 ай бұрын
What lol
@anti.zoo.soldier
@anti.zoo.soldier 6 ай бұрын
@@morebblakeyyy im sorry but my little brother tryed unity And He just raged So this happend
@nequick1462
@nequick1462 Жыл бұрын
majka umrla
@CoolllamaTMM
@CoolllamaTMM Жыл бұрын
dosnt work
@bblakeyyy
@bblakeyyy Жыл бұрын
Does still work currently. Double check your code, editor setup, etc
@Jake7i
@Jake7i Жыл бұрын
@@bblakeyyy Cannot get it to work any longer either with newest Unity Update.
@bblakeyyy
@bblakeyyy Жыл бұрын
@@Jake7i What's your issue
@Rayvooo
@Rayvooo 4 ай бұрын
Player movement doesn't work at all
@ITYWTD_
@ITYWTD_ 9 күн бұрын
What’s not working?
@Rayvooo
@Rayvooo 8 күн бұрын
@@ITYWTD_ well that was a long time ago and from what i remember i abandoned that project but it was propably just my fault
@charlieslives
@charlieslives 2 жыл бұрын
You are amazing thank you very much
@ClickIt-Drawgon
@ClickIt-Drawgon 2 ай бұрын
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)
@Maffekaffe
@Maffekaffe 2 ай бұрын
you can lock z movement on the rigidbody to the player in constrains
Unity 2D Smooth Camera Follow Tutorial
6:34
MoreBBlakeyyy
Рет қаралды 6 М.
2 Ways to do a Ground Check | Unity 2D Platformer Tutorial #2
9:28
MoreBBlakeyyy
Рет қаралды 15 М.
🍟Best French Fries Homemade #cooking #shorts
00:42
BANKII
Рет қаралды 39 МЛН
100❤️ #shorts #construction #mizumayuuki
00:18
MY💝No War🤝
Рет қаралды 20 МЛН
Mirrors, Every Way You Can Make Them In A Video Game
8:14
Code It All
Рет қаралды 22 М.
Creating SMART enemies from scratch! | Devlog
5:40
Challacade
Рет қаралды 258 М.
Code Class - 2D Player Movement in Unity
29:02
AdamCYounis
Рет қаралды 24 М.
Modular Combo System for Combat in Unity
20:29
The Game Dev Cave
Рет қаралды 29 М.
Improve Your Platformer with Forces | Examples in Unity
7:01
Dawnosaur
Рет қаралды 164 М.
2D Shooting in Unity - 2022 Tutorial
17:10
Muddy Wolf
Рет қаралды 28 М.
3 ways to do a Ground Check in Unity
15:58
Code Monkey
Рет қаралды 221 М.
First Person Movement Unity 2022
3:47
BloxyDev
Рет қаралды 45 М.
Как он смог забить гол
0:59
Garga
Рет қаралды 1,8 МЛН
DOG vs CAT - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
0:13