How to make a 2D platformer - Unity Tutorial Crash Course

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

КОМЕНТАРІ • 587

  • @bblakeyyy
    @bblakeyyy  Рік тому +8

    I have a ton of scripts and assets related to this and my other tutorials that can help you out on my Patreon:
    www.patreon.com/BlakeyGames

    • @HyperCars_Vlog
      @HyperCars_Vlog 9 місяців тому

      How many levels this game have?

    • @Magic8112
      @Magic8112 5 місяців тому +1

      i cant make the player jump

    • @strelenykerik
      @strelenykerik Місяць тому

      @@Magic8112 me too

  • @orpheusyw
    @orpheusyw 3 роки тому +77

    Best tutorial I could find on Unity 2D Platformer! All other tutorial often go too fast or is using too many outside resources that is hard to follow. This one is just simple and perfect to get started! Thank you!

  • @eggabacon
    @eggabacon Рік тому +8

    I've tried so many times to make games using both Unity and Unreal Engine, but never did anything with it, however this video was very simple and useful, and I absolutely loved it. Thank you so much for making this.

  • @Sw5pher
    @Sw5pher 2 роки тому +20

    WOW!! AMAZING!!!! This channel is TOO underrated, this was easy to understand and super simple to follow!

  • @kibookamc
    @kibookamc 11 днів тому

    i like the fact that you explain what the code does, not just doing it. the other tutorials i see from other youtubers, are like just copy what i do even if you dont know what this does

  • @Max-ko8fm
    @Max-ko8fm 2 роки тому +14

    Very good video! This is the best 2d platformer tutorial that I've found because most tutorials start with a tile-set which makes it hard to follow.

  • @printerman9834
    @printerman9834 Рік тому +12

    Best tutorial I've found so far. No frills or pointless gabbing, just straight to the point, concise good information. Cheers mate

  • @endyproductions6209
    @endyproductions6209 2 роки тому +6

    I was so flipping happy when I did the movement script tears came, thank you so much 🙏

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

      Glad to hear that my friend!

  • @ThatJaMzGuy
    @ThatJaMzGuy 2 роки тому +3

    its been 5 years since i used unity this was the refresher as simple as it was i really needed it .Good jump !!

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

    The code to stop jumping mid air won't work

    • @bossofbarleybs
      @bossofbarleybs 5 місяців тому +1

      Ye i have the same problem

    • @VoidTentacion
      @VoidTentacion 2 місяці тому +1

      My problem is This Compiler Error thing. I have no idea Where that is

  • @MrRisko10
    @MrRisko10 2 роки тому +8

    Great Tutorial. One of the best tutorial I found. It’s not to fast or to slow. Just the correct speed.👍

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

    BRO! I have been looking around for a tutorial like this for AGES! thank you so much!

  • @keetee-ei3er
    @keetee-ei3er Рік тому +1

    Basically just hit the keys and hit the head to the wall until something happens on the screen and repeat the same over and over again. Just be patient with yourself, try different methods of learning etc. After watching tutorials try to build something using the concept you just learned, seek help and reminders after you stuck a dead end, try by yourself first. Slow by slow kick the bar higher and repeat the same learning process. Try to learn the logic behind the code concepts, but for sure you don't have to know everything. Eventually you will learn something. Building small projects again and again and then adding always some new and difficult to the project

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

      Good advice!

    • @keetee-ei3er
      @keetee-ei3er Рік тому +1

      @@bblakeyyy Thanks for your help! By the way, background music did not get unnoticed, great and relaxing atmosphere 🎼

  • @kibookamc
    @kibookamc 11 днів тому

    if you dont want to jump iwht space but instead vertical, just but in the quoations "Vertical"
    then go to edit -> project settings -> input manager -> axes -> vertical , then make sure there is nothing in the negative and alt negative

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

    Best tutorial on 2D plattformer imo. I will make my own 2D game eventually, thanks for your help.

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

      Glad to hear it dude!

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

      @@bblakeyyy thanks! I played your invisible platform game and loved it so much!!! But how does it save your progress? And how do I go back to menu?

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

      Thanks! That game was made around 3 years ago now, it was my first ever game, so doesn’t have a lot of the typical functionality a good game should.
      It saves ur progress by loading you into the level and saving the level ur in via an int :)

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

      @@bblakeyyy Great thanks

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

    i have watched dozens of videos, to ensure that i am able to find the proper videos to help me. and yous are perfect. you deserve much more.

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

    This video makes all the concepts so much easier even a year later. Keep it up! 👍

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

    There's a bug in this game" if you add a wall with a collider and everything, if you hold the AD keys when touching it, your character will stick to the wall.

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

    Love your tutorials dude. Thank you so much for all the help and keep up the amazing work!

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

    I thought that brackeys is the best tutorial to watch but after 2 minutes I didn't know what's going on... but you just keep it very simple and you explain everything very well keep it up. I'm going On the next tutorial so bye 👋

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

    Great tutorial! Watched until the end and everything worked. I am new to C# but you explained the code very well. Keep it up, homie.

  • @Lou2a.a
    @Lou2a.a 2 роки тому

    amazing channel! i cant believe this quality only has 2k subs definitely subbed

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

    It doesn’t let me grab the rigidbody2D.. can someone help? I don’t know what I did wrong. I’m using vs2022 btw

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

    22:37 BIG REMINDER to be mindful of how you're naming things! I was scratching my head why the "End" didn't load Scene2/level2 on collision. Welp! Named the Scene "Level 2", and upon putting the code, I put "Level2", sooo that space had me running loops for a good 3 minutes lol. I always forget how literal, word-by-word scripting/coding is...

  • @vinhdev6803
    @vinhdev6803 2 роки тому +15

    I am using the new unity version and I think you will need to set Rigidbody2D in PlayerMovement script to public 'cause set it to private will make Rigidbody2D cannot work

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

      Ty bro I wondered why speed didn’t show up even though it was public😅

    • @raviensermo3103
      @raviensermo3103 9 місяців тому

      ur a legend with me it didnt work but thank you smh

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

    At 15:53 in the video, my recommendation is to not change “collision” to “other” as when I changed it to “other” my jumping did not perform correctly. But keeping it as “collision” made it work perfectly

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

      Your issue was most likely elsewhere, changing to other should not cause issues

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

    Great video just finished half now and going going to finish it tomorrow

  • @GamingPlush64
    @GamingPlush64 2 роки тому +8

    There's a bit of a flaw in the way you coded your jumping. Whenever I'm against an object, even when there's no ground beneath it, I'm able to jump. Sometimes I hit an edge at such an angle that it disables my jump when I land, thinking that I'm still against it. Any idea how to fix that?

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

      try to give a extra space in your collision compared to the sprite

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

      yeah i saw this but in a way i kind of like it

  • @XPLaxative
    @XPLaxative 2 роки тому +3

    I set my speed to private and didn't declare it I just assigned it there and then. I prefer it that way. Works great if anyone else wants to use it 'private float speed = 10f;'

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

    this is the most helpful video that i've watched for unity. great explanations thank you!

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

    This and GMKT are the best Unity Tuts on UA-cam frfr

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

    Thank You! It was my first time I started to make the games and you really helped me to get in! God bless you, bro!

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

    Thank you for this tutorial, Blakey, you really helped me out here. It was straight to the point and clear so I could copy everything neatly. You are a lifesaver.

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

      You spell it bblakeyyy

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

      It’s alright, I actually go by Blakey on discord and stuff so works out :)

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

      @@bblakeyyy ok

  • @Sniper_Fam101
    @Sniper_Fam101 2 роки тому +3

    Deserves a sub with all notifications best one out of the 13 tutorial video and easy!
    Edit:I did not expect to get a heart but thank you:)

  • @HistoryandScience-o7p
    @HistoryandScience-o7p Рік тому +3

    i copied the code for moving but it don't work

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

      You also have to adjust the things and stuff

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

    hello to if your rigidbody and your monobehaviour arent working youve got to go to edit in the editor>prefrences>External tools and then set external script editor to the current code program your using in my case VS(Visual Studio)

  • @VoidTentacion
    @VoidTentacion 2 місяці тому +2

    Microsoft Doesn't let me download Visual Studio so I have to go on a Third-Party Website to Download it
    Edit: Also I use an Older Version of Unity And have no idea Where Compiler Errors are.

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

    Hey! I have a tutorial channel dedicated to just tutorials now! It can be found on my featured channels list!

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

      Hi I used this tutorial and when I implemented the movement part it gave me a syntax error and wouldn't show up in components tried one I found on stack over flow and didn't work either can you help? btw I was using unity 2020.3.

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

      @@notmelloyello Mind providing the script? Copy and paste it here

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

      9:45

    • @4ndrito
      @4ndrito Рік тому

      how do i add double jumping

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

    Brilliant. A whole, simple game. All I need to do now is swap out for sprites and duplicate assets everywhere. Thank ewe Bblakeyyy

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

    Legend! Simple and straightforward, with good explanations!

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

      glad to hear it! subscribe to the second channel for more tutorials!

  • @raviensermo3103
    @raviensermo3103 9 місяців тому +1

    the jump doesn't work

  • @Jakey398
    @Jakey398 9 місяців тому +1

    For some reason, my duck (which is what I used as the sprite) will spin randomly (when it goes over a corner too far or something similar, it will rotate around and it is quite annoying if I'm honest)

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

      @thinic1Just got to working on the game now, that fixed it, thanks for the help!

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

    underrated channel +1 like

  • @lostkin4910
    @lostkin4910 2 роки тому +3

    For anyone who can get the menu to work, but clicking the resume button does nothing, the text needs to be the child object of the button. Dont know why thats the case but i figured it out

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

    I have been trying to figure out player controls forever now thank you so much!

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

    This was an amazing and extremely helpful video, thank you and keep up the good work

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

    This video was so good I'd buy you a free cup of coffee at the Jiffy Lube waiting room.

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

      That is so randomly specific

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

      This did also leave me baffled but appreciated nonetheless

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

    Excellent video! Simple enough to understand, but not TOO simple. Thanks.

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

    You explicated the code really good and like @Orpheus YW said the other tutorials of how to make a platformer on unity2D uses other sources or they are just simply not finished
    definitely subscribing

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

    So Clear, Useful, Easy to learn and advanced at the same time
    All the thanks to you^^

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

    I can’t do the rigidbody. It won’t highlight

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

    Hi loved the tutorial. Helped me a lot and maked me take my first steps. But, thee movement and jumping scriptt didn't work to me. Do you know a script for only jumping? I would really apriciate it. Thanks for all!!!

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

    Thanks, I found this very good. Not simple, but that’s not your fault. It was the computer.

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

    in the script for the basic movement part, when I added it as a component, the option speed didn't show up, did anyone come across the problem?

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

      mine for example doesn't make statements like Rigidbody2D and Vector2 green. Is that normal?
      Although it works
      I have never programmed

    • @KipsterFur
      @KipsterFur 11 місяців тому

      I’m glad I’m not the only one

  • @stevboi4867
    @stevboi4867 2 роки тому +22

    the first script doesn't work for me, a lot of the text isn't highlighted

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

      Same for me did u solve the problem yet ?

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

      @@Chubzdoomer thank you

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

      @@Chubzdoomer You are a literal GOD my friend!!!!! Thank you from the bottom of my heart

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

      Its not working for me too

    • @greenercancube-or5wo
      @greenercancube-or5wo Рік тому +1

      Any one who’s sees this he was most likely using a different colour scheme so it may not be the same, and if the code doesn’t work check for capitals and semicolons and mistakes the smallest mistake can cause problems and the whole thing won’t run

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

    Thank you for this tutorial itll help me learn the basics of unity I'm going to try and make other games with the code that I learned and further improve my coding skills

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

    ERROR :
    Assets\PlayerMovement.cs(43,18): error CS0111: Type 'PlayerMovement' already defines a member called 'OnCollisionEnter2D' with the same parameter types

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

    Very friendly to mobile viewers. Good and fast tutorial to start create your first platformer game.

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

      Friendly to PC viewers too! Really simple to follow, and I'm watching this on a computer!

  • @Just.A.Opinon
    @Just.A.Opinon 3 місяці тому

    this was a amazing tutorial it is my first game and since you explained the code good. i can now do some stuff on my own, Thank you!

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

    Please help I tried to rename the project while it’s opened and everything got corrupted😭 does anybody know how to fix it😭😭😭😭😭😭😢😢😢😢I hope someone replies🙏🙏🙏

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

    my computer
    doesn't have the requirements for visual studio what should i do

  • @funkyworm-o5r
    @funkyworm-o5r 2 роки тому +2

    is it just me or is the ground check not working

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

      Not just u.😩 I can't get "private void OnCollisionExit2D(Collision2D other) " it is killing me and I want to give up!

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

      same

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

    where is the next episode bro?????

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

    How to make smooth camera movement:
    public GameObject target;
    public int smoothing;
    void Update()
    {
    float x_diff = (target.transform.position.x - transform.position.x) / smoothing;
    float y_diff = (target.transform.position.y - transform.position.y) / smoothing;
    transform.position += new Vector3(x_diff, y_diff, -10);
    }
    feel free to copy

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

    The end cube which is meant to transport you to the. New level does not work . I am using the new input system for movement as well

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

    20:11 you dont have to use a script for the camera, you can just parent it to the player object

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

      ty, my camera script was broken and i had no idea what to do

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

      @@Physicsless8 no problem, it's also very good for 3d games too

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

    I can't find my script in the components

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

    WTF THANK YOU THANK YOU THANK YOU!!!! I WAS LOOKING FOR A SUCH A GOOD VIDEO LIKE THIS AND I FOUND IT!! YOU HELPED ME SO MUCH!!!! Edit: at the void command lines I stuck bc this shows error here (help)

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

    I did the movement script EXACTLY how you did it, but there is no speed variable in the component.
    Please comment why.

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

      I can’t comment why if you’ve said you’ve done it exactly how I’ve done it yet it doesn’t work

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

      @@bblakeyyy oh damn...

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

      im having the same issue as well

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

    Whenever my player hits the side of a wall, he just grabs the wall and doesn't fall. Is there a fix to this?

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

    I finished ! it's a very good tutorial Thank you !

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

    THANK YOU SO MUCH! THIS TUTORIAL IS SUPER EASY!!! I CAN FINALLY MAKE 2D GAMES!

  • @IM-ws5if
    @IM-ws5if 2 роки тому +1

    My first time i make a game in unity thanks bro

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

    Why my pause menu is not working? It shows up like 1sec and disapears.

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

      i have the same issue

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

      Answer pls how i fix it

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

      @@santtu8684 i dont know

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

    This tutorial is very good but i have one question.When i go to new component and type player movement there isn't my script.Please help me bye:)

  • @CrashFranks-y9d
    @CrashFranks-y9d Рік тому

    you got a new subscriber very clear and beginner friendly

  • @Philip-qq7ql
    @Philip-qq7ql 2 роки тому +1

    My door simply doesn't work, i have made sure that there are no typos and I added it to build settings but when I touch it nothing happens

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

      make sure the player actually has the 'player' tag that you're referencing in the script.

  • @glorionn1523
    @glorionn1523 2 роки тому +3

    Is there a way to make the player cant stick himself with the side part of the ground? ( I hope someone understands what I mean )

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

      add a physics material with 0 friction

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

      ​@@bblakeyyy Yay its works, but sadly the player is still able to jump on the ground. And i just remember today that I ask this question 12 days ago lol

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

    fist game ive made I wasn’t able to figure out the pause menue bc my buttons just wont work but thats fine. I had so many probloms with coding that took me hours to figure out but finally did it. geat tut !

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

    Every legend started here... o7 o7 o7

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

    in the 22:19 of the vid i acsidntly pres on the other opthion(not on the relode) it delted olmost evry thing, what can i do. pls help

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

    I think the button and text objects shouldn't be siblings because then you click the buttons (I found out after some time). So i've parented the button object for the text object, and now the button objects aren't obscured by the text objects.

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

    Amazing, simple and well explained.

  • @ARCHERKO484
    @ARCHERKO484 5 місяців тому +1

    12:16 I do it right like you but I cant choose the speed can you help me?

    • @Yrekcaz7
      @Yrekcaz7 5 місяців тому +1

      me neither :|

    • @Plapp_
      @Plapp_ 2 місяці тому +1

      @@Yrekcaz7 Im very late but I had the same issue and found that you need to press ctrl+S to save the script in visualstudio which will make it update in Unity, I think this video is just a tad outdated

    • @AndreiCojoaru
      @AndreiCojoaru Місяць тому

      Yea bro idk I guess he’s stupid

    • @DW222-u3x
      @DW222-u3x 25 днів тому

      @@Plapp_but i got an error

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

    i cant find player movement on the components

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

    Everything works amazingly, even figured out what i was doing wrong with the buttons except that everything ABOVE resume selects resume, but if im anywhere below it highlights quit. Is there a way to make it to where the only place you can select is the actual buttons and not anywhere around them?

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

    The best video ever , thanks 😃

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

    Hi bblakeyyy when I change my speed for my player then press play it makes it 0 and when I press the button for moving it only goes to 1 pls help

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

      Hello pls help

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

      @@godofgames666 ctrl s to save changes

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

      @@parkher4186 thx bug I’m already done with the game

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

    Does anybody have any ideas on how to flip the character when you move?

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

    Finally, a good tutorial.

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

    Bug with the Pause Menu Buttons, it works in my level 1 scene but not in my level 2 scene. I can still use the escape key to access the pause menu, it’s just the buttons that are doing nothing.

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

    anyone know how to fix the pause menu, all I see is the cursor, the buttons don't work ( no script errors )

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

      did you find a fix

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

    OMg this is amazing tutorial, please upload more tutorial i really learned new things but i am having some issue

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

    Best tutorial out there !

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

    the movement script didnt work for me, i even checked every line to see if it was the same so i asked chatgpt to make it and it works

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

      how did it work?? can you help me please

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

      @@rrodann
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerMovement : MonoBehaviour
      {
      public float speed;
      public float jump;
      public bool isJumping;
      private Rigidbody2D rb;
      // Start is called before the first frame update
      void Start()
      {
      rb = GetComponent();
      }
      // Update is called once per frame
      void Update()
      {
      float move = Input.GetAxis("Horizontal");
      rb.velocity = new Vector2(speed * move, rb.velocity.y);
      if (Input.GetButtonDown("Jump") && !isJumping)
      {
      rb.AddForce(new Vector2(rb.velocity.x, jump));
      isJumping = true;
      }
      }
      private void OnCollisionEnter2D(Collision2D other)
      {
      if (other.gameObject.CompareTag("Ground"))
      {
      isJumping = false;
      }
      }
      private void OnCollisionExit2D(Collision2D other)
      {
      if (other.gameObject.CompareTag("Ground"))
      {
      isJumping = true;
      }
      }
      }

  • @justRELAX-dk3nh
    @justRELAX-dk3nh 2 роки тому +1

    SIR, HOW CAN I JUMP FROM LEVEL 2 TO LEVEL 3
    ----I DID TRY TO CHANGE IN FINISHLINE BUT WHEN I CHANGE LEVEL 2 INTO LEVEL 3, IT DIRECTLY JUMPS FROM LEVEL 1 TO LEVEL 3????
    ------PARDON MY GRAMMER...

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

      You have a FinishLine Script in the "Level1" and "Level2" Scenes right? On the Script for "Level1" you set "SceneManager.LoadScene(...)" to "Level2", then change the Script for the "Level2"-Scene to "SceneManager.LoadScene(...)" to "Level3". Adjust names to whatever your Level-Scenes are named.

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

      @@SergeantSam3D do you have any idea why when the player attached to death and respawn the player is disappeared but the camera still moving

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

      just, relax!

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

    Please help! I'm currently stuck on the Scene loading part as it won't let me start my game as an error keeps showing saying "The name 'Level2' doesn't exist in this current context". How can I fix this?

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

    When i type Rigidbody2D it's not getting highlighted as your's, pls respond.

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

      Vector2 is not getting highlighted either.

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

    The variables didn't show up in the PlayerMovement Component..

  • @quinted69
    @quinted69 2 роки тому +3

    This video is great!! But for some reason I cant get the player to move, even after i typed in the script and connected it to the player, the gravity does not even work

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

      Do you have a rigid body 2d on it?

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

      @@tombrandis because it sould work if you do