Unity 2D Player Move and Jump with Groundcheck Tutorial

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 171

  • @sleepyboi5739
    @sleepyboi5739 2 роки тому +35

    Bepedi bopity . Your code is now my property

  • @foros9548
    @foros9548 Рік тому +7

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

  • @GaganKumar-fz6wz
    @GaganKumar-fz6wz Рік тому +3

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

  • @mrdragon7769
    @mrdragon7769 Рік тому +3

    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 Рік тому +2

      SAME but ground check does not working still

  • @Boogie-wi7hd
    @Boogie-wi7hd Рік тому +4

    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

  • @ODmn25
    @ODmn25 11 місяців тому +1

    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

  • @RavDeBest
    @RavDeBest Рік тому +1

    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.

  • @HaydnGable
    @HaydnGable 4 місяці тому

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

  • @glowingshard-bfdi
    @glowingshard-bfdi 8 місяців тому

    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 2 роки тому +2

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

  • @apcrothon6047
    @apcrothon6047 2 роки тому +4

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

  • @glass_eater11
    @glass_eater11 5 місяців тому

    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

  • @perbara1991
    @perbara1991 3 місяці тому

    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.

  • @Blinkski2
    @Blinkski2 3 місяці тому

    after trial and error this tutorial helped me thank goodness i almost gave up

  • @NatronBlood
    @NatronBlood 3 роки тому +5

    knowledge rules everything around me!

  • @donalbrennan7289
    @donalbrennan7289 2 роки тому +2

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

  • @Real_Wollus
    @Real_Wollus 6 місяців тому

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

  • @altertonart1085
    @altertonart1085 7 місяців тому

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

  • @painithin
    @painithin Рік тому

    Very well shown and explained 👍🏽

  • @matthewwilliamsvideos
    @matthewwilliamsvideos 6 місяців тому

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

  • @coolname2709
    @coolname2709 2 роки тому +1

    finally i found a good tutorial

  • @senecatheweeb1604
    @senecatheweeb1604 8 місяців тому

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

  • @atonyrodelo
    @atonyrodelo Рік тому +1

    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

  • @editsforevery1
    @editsforevery1 8 місяців тому

    thank you bro, amazing!

  • @FoodNomsNoms
    @FoodNomsNoms 2 роки тому +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

  • @BabuWasHere
    @BabuWasHere Рік тому +1

    very helpful 👍

  • @yoav_tc
    @yoav_tc 2 роки тому +2

    Thanks! Works in 2022, helped me a lot!

  • @bazzer360
    @bazzer360 3 роки тому +1

    Saving this one for a future project

  • @fezik7697
    @fezik7697 3 місяці тому

    thank you man so much

  • @bumberto_eko1068
    @bumberto_eko1068 2 роки тому

    my cube is just going right cool

  • @guyturtle8927
    @guyturtle8927 11 місяців тому +2

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

  • @aenathemas9596
    @aenathemas9596 2 роки тому +1

    Great!!

  • @bogm5801
    @bogm5801 Рік тому +2

    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 11 місяців тому +1

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

  • @Osoclever
    @Osoclever 7 місяців тому

    Your awesome thank you

  • @betsydillard3857
    @betsydillard3857 2 роки тому +1

    I like the chapters!

  • @sonny_days
    @sonny_days Рік тому +1

    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

  • @joaoi.9920
    @joaoi.9920 6 місяців тому

    You re the best

  • @Jihmark
    @Jihmark Рік тому +2

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

    • @averageviewer8511
      @averageviewer8511 Рік тому +1

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

  • @csabaszabo2189
    @csabaszabo2189 Рік тому

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

  • @EdosBlu
    @EdosBlu 5 місяців тому

    thanks soo much

  • @smucsaurzs
    @smucsaurzs 8 місяців тому +2

    the script things that show under it dont show for me

  • @DeadlyInsaan
    @DeadlyInsaan 2 роки тому +2

    Thanks!

  • @snabee5290
    @snabee5290 2 роки тому +2

    what a real babe

  • @MusicMagic700
    @MusicMagic700 2 роки тому +1

    Keep going , and thank you 😊

  • @justusisbestest4122
    @justusisbestest4122 2 роки тому

    thank you so much!!!!!

  • @sumdeathjr
    @sumdeathjr Рік тому +2

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

  • @sachinkankane9877
    @sachinkankane9877 2 роки тому +1

    Thanku so much bro ❤️❤️

  • @anjaneshpal8825
    @anjaneshpal8825 Рік тому

    thank you

  • @neozoid7009
    @neozoid7009 Рік тому

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

  • @PawelHerok
    @PawelHerok 2 роки тому +1

    Thank you
    Very cool :)

  • @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 6 місяців тому

      This wouldn't work on slopes

  • @145Jamie
    @145Jamie Рік тому +1

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

  • @expungedsfist
    @expungedsfist 4 місяці тому

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

  • @BassJunkeeZ
    @BassJunkeeZ 2 роки тому

    thanks

  • @tesfalemgaming
    @tesfalemgaming Рік тому +1

    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 6 місяців тому

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

  • @wasabihulk4731
    @wasabihulk4731 2 роки тому +1

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

  • @69420bet
    @69420bet 2 роки тому

    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.

  • @Raptishy
    @Raptishy 2 роки тому

    I just go straight up

  • @yahyagd5637
    @yahyagd5637 6 місяців тому

    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

  • @toonztheunknown6164
    @toonztheunknown6164 Рік тому

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

  • @ProyectoUnity
    @ProyectoUnity 3 місяці тому

    i did everything exactly the same but im still double jumping?

    • @Chilli_Tea
      @Chilli_Tea 2 місяці тому

      probs missed out the 2d at the end of the collision methods

  • @fglobal853
    @fglobal853 Рік тому

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

  • @mechxp2008
    @mechxp2008 Рік тому

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

  • @yungjetskimihara2
    @yungjetskimihara2 2 роки тому +1

    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 2 роки тому

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

  • @pffguy133
    @pffguy133 Рік тому

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

  • @xelber2935
    @xelber2935 2 роки тому +1

    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

  • @forrester659
    @forrester659 Рік тому

    ARAZI OLSUN

  • @APLL_18
    @APLL_18 7 місяців тому

    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 7 місяців тому

      you can lock z movement on the rigidbody to the player in constrains

  • @Wesleygoodboy
    @Wesleygoodboy Рік тому

    What is the version of your Microsoft visual studio?

  • @Chilli_Tea
    @Chilli_Tea 2 місяці тому

    raycasting is probs easier but cool vid anyways

  • @isimsizanimator1291
    @isimsizanimator1291 Рік тому

    i just want double jump how can i do this

  • @coonstar
    @coonstar Рік тому

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

  • @oivariini7
    @oivariini7 2 роки тому

    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?

  • @ekoproductions.1949
    @ekoproductions.1949 2 роки тому

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

  • @TypekMD
    @TypekMD Рік тому

    I doesnt show the variables in unity

  • @Frederick-Gregory
    @Frederick-Gregory 2 роки тому +1

    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!

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

  • @Dagoldenaxolottl7808
    @Dagoldenaxolottl7808 Рік тому

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

    • @guyturtle8927
      @guyturtle8927 11 місяців тому +1

      You have to rite Jump
      Not jump

  • @adrianmeyer2157
    @adrianmeyer2157 2 роки тому +1

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

  • @alikaiyr6308
    @alikaiyr6308 Рік тому

    rakhmet man

  • @xDTHECHEMISTx
    @xDTHECHEMISTx 2 роки тому +1

    will you create a tutorial for 2Dcharacter attacks?

  • @Goatrigg
    @Goatrigg Рік тому

    I don't understand the 4:52 part

  • @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 Рік тому +1

      You’re missing a } on line 30

    • @swasdefguv
      @swasdefguv Рік тому

      @@bblakeyyy thanks

  • @Surron_ian
    @Surron_ian 2 роки тому

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

  • @progaming915
    @progaming915 2 роки тому

    what language do u use for the programming?

  • @daffadziibaankhoiri1176
    @daffadziibaankhoiri1176 Рік тому

    what is key for jump?

  • @loboleigh7337
    @loboleigh7337 2 роки тому

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

  • @t.b.g158
    @t.b.g158 2 роки тому

    If "Input.GetAxis("Horizontal");" is the old method what is the new one?

    • @morebblakeyyy
      @morebblakeyyy  2 роки тому +1

      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 роки тому +1

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

  • @DerriousDancer
    @DerriousDancer Рік тому

    This didn't work I need help

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

  • @highonowlmoist409
    @highonowlmoist409 Рік тому

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

    • @manangrover2086
      @manangrover2086 7 місяців тому

      its been 9 months found any fix to it ?

  • @anasfaidhy5674
    @anasfaidhy5674 2 роки тому

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

  • @lehmspielt
    @lehmspielt 2 роки тому

    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!

    • @GodSpeed_0vO
      @GodSpeed_0vO Рік тому

      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 Рік тому

      @@GodSpeed_0vO thanks!

  • @foxheals
    @foxheals 2 роки тому +1

    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 роки тому +1

      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

  • @Anti_furry.Soldier
    @Anti_furry.Soldier 11 місяців тому

    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  11 місяців тому

      What lol

    • @Anti_furry.Soldier
      @Anti_furry.Soldier 11 місяців тому

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

  • @charlieslives
    @charlieslives 2 роки тому +1

    You are amazing
    thank you very much

  • @Coolllama
    @Coolllama 2 роки тому +1

    dosnt work

    • @bblakeyyy
      @bblakeyyy 2 роки тому

      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

  • @MotionFishy
    @MotionFishy 10 місяців тому

    Player movement doesn't work at all

    • @glass_eater11
      @glass_eater11 5 місяців тому

      What’s not working?

    • @MotionFishy
      @MotionFishy 5 місяців тому

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

  • @brockkenney6428
    @brockkenney6428 Рік тому

    I won't let me jump

  • @cunamiflow
    @cunamiflow 2 роки тому

    majka umrla