Unity 2D Player Move and Jump with Groundcheck Tutorial

Ойындар

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...

Пікірлер: 166

  • @sleepyboi5739
    @sleepyboi5739 Жыл бұрын

    Bepedi bopity . Your code is now my property

  • @apcrothon6047
    @apcrothon60472 жыл бұрын

    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!!!!!

  • @GaganKumar-fz6wz
    @GaganKumar-fz6wz Жыл бұрын

    Thank you so much, I spent my too much time to following lots tutorials but no one works. This tutorial helped me.

  • @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

  • @HaydnGable
    @HaydnGable3 күн бұрын

    After scouring the internet for hours looking for this solution, this tutorial is the only thing I found that actually worked.

  • @VoidStudios25
    @VoidStudios257 ай бұрын

    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

  • @foros9548
    @foros954811 ай бұрын

    Finally a simple and good way to check for ground thanks for the help mate

  • @draftdimension9079
    @draftdimension90792 жыл бұрын

    Thanks I have been trying to figure this out for at least three days.

  • @glowingshard-bfdi
    @glowingshard-bfdi4 ай бұрын

    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

  • @painithin
    @painithin8 ай бұрын

    Very well shown and explained 👍🏽

  • @ITYWTD_
    @ITYWTD_2 ай бұрын

    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

  • @Real_Wollus
    @Real_Wollus2 ай бұрын

    Thank you so much❤ it took me 6 hours to find a working tutorial xD

  • @matthewwilliamsvideos
    @matthewwilliamsvideos3 ай бұрын

    Thank you soooooo much for this you have no idea the trouble it saved me

  • @mrdragon7769
    @mrdragon7769 Жыл бұрын

    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

    Жыл бұрын

    SAME but ground check does not working still

  • @editsforevery1
    @editsforevery14 ай бұрын

    thank you bro, amazing!

  • @RavDeBest
    @RavDeBest11 ай бұрын

    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.

  • @altertonart1085
    @altertonart10853 ай бұрын

    late to viewing, but love how you explain what the code does and is easy to follow!

  • @senecatheweeb1604
    @senecatheweeb16044 ай бұрын

    Thank You!!!!!!!!!!!!! this vid means more than you'll ever know

  • @atonyrodelo
    @atonyrodelo10 ай бұрын

    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

  • @donalbrennan7289
    @donalbrennan7289 Жыл бұрын

    only tutorial i found that actually explains the code you're writing and how it works n stuff - thank u !!

  • @tiemlee723
    @tiemlee723 Жыл бұрын

    Thank you so much because it working

  • @coolname2709
    @coolname2709 Жыл бұрын

    finally i found a good tutorial

  • @BabuWasHere
    @BabuWasHere8 ай бұрын

    very helpful 👍

  • @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

  • @pirateninjagamer1684

    @pirateninjagamer1684

    Ай бұрын

    @@morebblakeyyyafter I’m done coding and in scene and have my player selected on the inspector panel on player Movement Script than there’s something that says IS JUMPING when I press play and jump than a check mark appears on the box and I can’t jump again How do I fix this???

  • @ADHDism3
    @ADHDism33 ай бұрын

    Your awesome thank you

  • @NatronBlood
    @NatronBlood2 жыл бұрын

    knowledge rules everything around me!

  • @FoodNomsNoms
    @FoodNomsNoms2 жыл бұрын

    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

  • @justusisbestest4122
    @justusisbestest41222 жыл бұрын

    thank you so much!!!!!

  • @aenathemas9596
    @aenathemas9596 Жыл бұрын

    Great!!

  • @EdosBlu
    @EdosBluАй бұрын

    thanks soo much

  • @Damsgaardo
    @Damsgaardo5 ай бұрын

    thank you

  • @guyturtle8927
    @guyturtle89278 ай бұрын

    Hey i tried everything but the jump didn't work can someone help me please? :(

  • @145Jamie
    @145Jamie10 ай бұрын

    How do you set up your Intellisense like that, mine isn't that suggestive

  • @wasabihulk4731
    @wasabihulk47312 жыл бұрын

    it says the name other does not exist in this context how do i fix it?

  • @sonny_days2751
    @sonny_days2751 Жыл бұрын

    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

  • @toonztheunknown6164
    @toonztheunknown6164 Жыл бұрын

    what should I do if the console says ArgumentException : input axis horizontal is not setup. after the first set of code

  • @yoav_tc
    @yoav_tc2 жыл бұрын

    Thanks! Works in 2022, helped me a lot!

  • @morebblakeyyy

    @morebblakeyyy

    2 жыл бұрын

    Glad to hear it! :)

  • @bumberto_eko1068
    @bumberto_eko10682 жыл бұрын

    my cube is just going right cool

  • @yahyagd5637
    @yahyagd56372 ай бұрын

    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

  • @69420bet
    @69420bet2 жыл бұрын

    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.

  • @neozoid7009
    @neozoid7009 Жыл бұрын

    Awesome , But why did you suggested to use raycast for a long term project ?

  • @sumdeathjr
    @sumdeathjr Жыл бұрын

    error CS0246: The type or namespace name 'RigidBody' could not be found (are you missing a using directive or an assembly reference?)

  • @csabaszabo2189
    @csabaszabo2189 Жыл бұрын

    Thx bro! Can you show the "flip" method to?:D

  • @AmogusSussy69
    @AmogusSussy69 Жыл бұрын

    how to make a double jump function pls answer :D

  • @BassJunkeeZ
    @BassJunkeeZ Жыл бұрын

    thanks

  • @joaoi.9920
    @joaoi.99203 ай бұрын

    You re the best

  • @user-mf9tp7qs4t
    @user-mf9tp7qs4t25 күн бұрын

    for me it just barley jumps and then when i increase the jump power it just teleports the square into the sky

  • @ekoproductions.1949
    @ekoproductions.1949 Жыл бұрын

    help please Script error: OnCollisionExit2D This message parameter has to be of type: Collision2D

  • @mechxp2008
    @mechxp2008 Жыл бұрын

    character speed, jump and rb is not showing up for me

  • @Wesleygoodboy
    @Wesleygoodboy Жыл бұрын

    What is the version of your Microsoft visual studio?

  • @coonstar
    @coonstar11 ай бұрын

    It says the modifier private is not valid for the item? Please help

  • @isimsizanimator1291
    @isimsizanimator1291 Жыл бұрын

    i just want double jump how can i do this

  • @pffguy133
    @pffguy133 Жыл бұрын

    The ground doesn’t work there are no errors and the code is the same pls help

  • @Jihmark
    @Jihmark Жыл бұрын

    Thank you for this tutorial. But what if I want to implement a double jump function?

  • @averageviewer8511

    @averageviewer8511

    9 ай бұрын

    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).

  • @oivariini7
    @oivariini72 жыл бұрын

    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

  • @fglobal853
    @fglobal853 Жыл бұрын

    Thank you very much! Can you please add crouch to that code please?

  • @smucsaurzs
    @smucsaurzs4 ай бұрын

    the script things that show under it dont show for me

  • @srogue112
    @srogue112 Жыл бұрын

    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

    Жыл бұрын

    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

    2 ай бұрын

    This wouldn't work on slopes

  • @bazzer360
    @bazzer3602 жыл бұрын

    Saving this one for a future project

  • @morebblakeyyy

    @morebblakeyyy

    2 жыл бұрын

    Glad to hear it!

  • @betsydillard3857
    @betsydillard38572 жыл бұрын

    I like the chapters!

  • @MusicMagic700
    @MusicMagic7002 жыл бұрын

    Keep going , and thank you 😊

  • @morebblakeyyy

    @morebblakeyyy

    2 жыл бұрын

    you're welcome :)

  • @DeadlyInsaan
    @DeadlyInsaan2 жыл бұрын

    Thanks!

  • @TypekMD
    @TypekMD8 ай бұрын

    I doesnt show the variables in unity

  • @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

    7 ай бұрын

    you probably forgot a ";" at the end of the line

  • @sachinkankane9877
    @sachinkankane98772 жыл бұрын

    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

    2 ай бұрын

    i have the same thing the movement is working but the jump doesnt

  • @oscardog2342
    @oscardog23422 жыл бұрын

    this and evey other unity 2d tutorial movement tutorial dosent work for me

  • @Dagoldenaxolottl7808
    @Dagoldenaxolottl78088 ай бұрын

    every time i try this, it just says'arguament Exception: input jump buttton is not setup'

  • @guyturtle8927

    @guyturtle8927

    8 ай бұрын

    You have to rite Jump Not jump

  • @PawelHerok
    @PawelHerok2 жыл бұрын

    Thank you Very cool :)

  • @morebblakeyyy

    @morebblakeyyy

    2 жыл бұрын

    Make sure to sub :)

  • @xelber2935
    @xelber29352 жыл бұрын

    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

    2 жыл бұрын

    It's intellisence follow my tutorial to fix it

  • @Padrrigg
    @Padrrigg Жыл бұрын

    I don't understand the 4:52 part

  • @yungjetskimihara2
    @yungjetskimihara22 жыл бұрын

    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

    2 жыл бұрын

    You fix it or not because i know why that’s happening

  • @yungjetskimihara2

    @yungjetskimihara2

    2 жыл бұрын

    @@kingdoom1906 nope

  • @gachastorys5129

    @gachastorys5129

    Жыл бұрын

    @@yungjetskimihara2 it might be an intellisense problem. Are you using visual studio?

  • @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

  • @t.b.g158
    @t.b.g1582 жыл бұрын

    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👌🏻

  • @progaming915
    @progaming915 Жыл бұрын

    what language do u use for the programming?

  • @guyturtle8927

    @guyturtle8927

    8 ай бұрын

    C#

  • @anasfaidhy5674
    @anasfaidhy56742 жыл бұрын

    how to fix (51,2): error CS1513: } expected

  • @musakeys5600

    @musakeys5600

    2 жыл бұрын

    Send screenshots

  • @Frederick-Gregory
    @Frederick-Gregory2 жыл бұрын

    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!

  • @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!

  • @snabee5290
    @snabee5290 Жыл бұрын

    what a real babe

  • @Raptishy
    @Raptishy2 жыл бұрын

    I just go straight up

  • @loboleigh7337
    @loboleigh73372 жыл бұрын

    its not working bc player movement speed jump wont show up :(

  • @user-gs3wo3oz2q

    @user-gs3wo3oz2q

    Жыл бұрын

    mee too

  • @DerriousDancer
    @DerriousDancer8 ай бұрын

    This didn't work I need help

  • @daffadziibaankhoiri1176
    @daffadziibaankhoiri1176 Жыл бұрын

    what is key for jump?

  • @nhatlinhphan4485

    @nhatlinhphan4485

    2 ай бұрын

    i think space?

  • @highonowlmoist409
    @highonowlmoist409 Жыл бұрын

    i dont have the same in my unity promaiters help plz. 5:25

  • @manangrover2086

    @manangrover2086

    3 ай бұрын

    its been 9 months found any fix to it ?

  • @TheGuyInTheHoddie
    @TheGuyInTheHoddie2 жыл бұрын

    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

  • @xDTHECHEMISTx
    @xDTHECHEMISTx2 жыл бұрын

    will you create a tutorial for 2Dcharacter attacks?

  • @morebblakeyyy

    @morebblakeyyy

    2 жыл бұрын

    Yeah sure

  • @foxheals
    @foxheals2 жыл бұрын

    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

  • @forrester659
    @forrester659 Жыл бұрын

    ARAZI OLSUN

  • @forrester659

    @forrester659

    Жыл бұрын

    razı*

  • @alikaiyr6308
    @alikaiyr6308 Жыл бұрын

    rakhmet man

  • @SubToPlunga
    @SubToPlunga Жыл бұрын

    your second channel has more subs than ur main

  • @morebblakeyyy

    @morebblakeyyy

    Жыл бұрын

    Indeed. Tutorials naturally do better then game development challenges and stuff so was planned.

  • @orionB08
    @orionB082 жыл бұрын

    The code is working pretty well but the 'Is Jumping' gets a tick automatically how can i fix it?

  • @musakeys5600

    @musakeys5600

    2 жыл бұрын

    Follow my tutorial

  • @brockkenney6428
    @brockkenney6428 Жыл бұрын

    I won't let me jump

  • @guyturtle8927

    @guyturtle8927

    8 ай бұрын

    Same here

  • @rashedalqarni118
    @rashedalqarni1182 жыл бұрын

    Is there code i can make it flip each side? Please

  • @musakeys5600

    @musakeys5600

    2 жыл бұрын

    Follow my tutorial

  • @briosh.mp4
    @briosh.mp4 Жыл бұрын

    this dont work

  • @roachdoggjr1940
    @roachdoggjr1940 Жыл бұрын

    what the fuck? why is my bool always set to false? did unity change something?

  • @Anti_furry.Soldier
    @Anti_furry.Soldier7 ай бұрын

    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

    7 ай бұрын

    What lol

  • @Anti_furry.Soldier

    @Anti_furry.Soldier

    7 ай бұрын

    @@morebblakeyyy im sorry but my little brother tryed unity And He just raged So this happend

  • @ItsBrickzz
    @ItsBrickzz6 ай бұрын

    Player movement doesn't work at all

  • @ITYWTD_

    @ITYWTD_

    2 ай бұрын

    What’s not working?

  • @ItsBrickzz

    @ItsBrickzz

    2 ай бұрын

    @@ITYWTD_ well that was a long time ago and from what i remember i abandoned that project but it was propably just my fault

  • @adrianmeyer2157
    @adrianmeyer21572 жыл бұрын

    Ah buzzin, it's mad how some of these problems are easy when shown how haha.

  • @morebblakeyyy

    @morebblakeyyy

    2 жыл бұрын

    nice one

  • @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

  • @nequick1462
    @nequick14622 жыл бұрын

    majka umrla

Келесі