Game Dev Basics: Let's make a 2D player controller in C# and Unity!

Поделиться
HTML-код
  • Опубликовано: 18 дек 2024

Комментарии • 851

  • @LostRelicGames
    @LostRelicGames  4 года назад +21

    I just released a new Unity Asset to help beginners make platformer games
    ​► ​u3d.as/2eYe​

    • @TheFurruWasTaken
      @TheFurruWasTaken 3 года назад +2

      that only leads to the asset store, not your page.

    • @greysoneduardo471
      @greysoneduardo471 3 года назад

      I know im asking randomly but does any of you know of a method to get back into an Instagram account??
      I was dumb lost my password. I appreciate any help you can offer me!

    • @jaycejake7851
      @jaycejake7851 3 года назад

      @Greyson Eduardo instablaster =)

    • @greysoneduardo471
      @greysoneduardo471 3 года назад

      @Jayce Jake I really appreciate your reply. I found the site through google and im waiting for the hacking stuff atm.
      Seems to take quite some time so I will reply here later when my account password hopefully is recovered.

    • @greysoneduardo471
      @greysoneduardo471 3 года назад

      @Jayce Jake it did the trick and I now got access to my account again. I'm so happy:D
      Thanks so much you really help me out !

  • @TalkingRaven_
    @TalkingRaven_ 4 года назад +402

    Who else is here because Brackeys decided to use a premade movement script?

    • @hutasoitnul
      @hutasoitnul 4 года назад +14

      THIS :'D

    • @novaplum1617
      @novaplum1617 4 года назад +6

      EXACTLY THIS!

    • @JPVersus_
      @JPVersus_ 4 года назад +4

      Yep

    • @TalkingRaven_
      @TalkingRaven_ 4 года назад +4

      @Ahmed Elnaeim his scripts are good enough ( When he actually teaches how to make them from scratch ) , but they're extremely simplified which is great, but in the long run, they really aren't that optimized, I guess that's a conscious choice to avoid overwhelming beginners with some intermediate stuff.

    • @jonathanmora8208
      @jonathanmora8208 4 года назад +11

      Brackey is trash I ended up confused watching his script vids .his is the worst channel to try to learn from

  • @timothyhitge9189
    @timothyhitge9189 5 лет назад +56

    So much better than all the other 2D PlayerController tutorials I've seen. It's refreshing to see a RUclipsr actually create the controller from scratch, as opposed to recommending a 3rd party script. Please do more game programming tutorials!

    • @LostRelicGames
      @LostRelicGames  5 лет назад +8

      Thanks Timothy, you hit the nail on the head with the 3rd party stuff. I have some full game making tutorials planned. Unity is in a transition phase with their Input system which has made making tutorials a problem, as they will all break the moment the new system rolls out. But I'm putting some stuff together. Make sure to sub, and visit the discord to hang out with me and talk gamedev :)

  • @ChakeN
    @ChakeN 5 лет назад +270

    Easily beats brackeys tutorial on this. Really great tutorial!

    • @LostRelicGames
      @LostRelicGames  5 лет назад +28

      Thanks so much. I plan to do more in depth game making series shortly. So come back for those! Have a fantastic day

    • @huylyN
      @huylyN 5 лет назад +20

      It really is more details than Brackeys that helps the learner understand how codes work. I like this video.

    • @InTheStevening
      @InTheStevening 5 лет назад +23

      I like Brackeys, but it seems to be more of a showcasing channel nowadays rather than a teaching channel. At least that's my impression.

    • @marten4story93
      @marten4story93 5 лет назад +1

      Yes i love this toutorial and it helps me to learn more

    • @Ray-lh3oc
      @Ray-lh3oc 5 лет назад +7

      @Susuya Juuzou i don't know I think that brackeys is just more focused on beginners who don't want to code hard code (EG. LINECASTS) BUT i DO THINK THAT SOME of his tuts are pretty good and usefull (eg. cinamachine tutorial). Another really good channel is blackthornprod but his tut on movement didn't help me as much as this one for my game.You just need to find out which channel is best suited for you as the learner

  • @QFGEE
    @QFGEE 4 года назад +32

    Scripting starts at 18:40 (The intro is pretty basic).
    Really appreciate that you didn't ask us to download a premade character controller like the other tutorials did (I hardly learnt nothing with them)

    • @LostRelicGames
      @LostRelicGames  4 года назад +11

      Hey thanks David, I hope you check out my newer vids, I'll be remaking this one very soon for unity 2020. Should be fun!

    • @funteav3437
      @funteav3437 Год назад

      @@LostRelicGames just finished the tut - best one around (Did you happen to remake this one for Unity 2020 one or latest?)

  • @dragomirpetrov5600
    @dragomirpetrov5600 4 года назад +22

    Hey Everyone. Just in case anyone has problems with the jump after they make the ground check, make sure the GO you are using is below the feet level of whatever char you are using. Decided to share this knowledge, after I struggled with it for two days :D

    • @kylek9593
      @kylek9593 4 года назад +4

      Thank you, I ran into this same issue and your solution fixed it.

    • @the_gearinator5797
      @the_gearinator5797 4 года назад +1

      Lad, thanks for the shout! Was confused for a good while xD

    • @Upsway
      @Upsway 4 года назад +2

      Thank you!

    • @WNTrombone
      @WNTrombone 3 года назад +1

      Thanks! I was getting very frustrated over this issue haha

    • @Ganonballer
      @Ganonballer 3 года назад +1

      omgosh thank you so much lmao. I was so confused on what was wrong lolol

  • @a-1b-2c-37
    @a-1b-2c-37 5 лет назад +134

    FINALLY SOMETHING THAT WOOOOOOOOOORKS! BETTER THAN BRACKEYS AND BLACKTHORNPROD THAAAAAAAAAAAANKS!

    • @LostRelicGames
      @LostRelicGames  5 лет назад +5

      Haha! Thanks for the high praise! It really means a lot. Make sure to check out my latest video and see if I'm on the right track. Will mix it up between that classroom style and this in depth tutorial format.

    • @popoporifox4229
      @popoporifox4229 5 лет назад

      true

    • @Ray-lh3oc
      @Ray-lh3oc 5 лет назад

      same i camehere cas they didn't work for my game

    • @owentheflybyguy
      @owentheflybyguy 4 года назад

      Nolimo(NOT IN USE Read channel desc) agreed

    • @nolimo2593
      @nolimo2593 4 года назад

      @@owentheflybyguy hhahaa

  • @yeruschmift8422
    @yeruschmift8422 5 лет назад +26

    The coding tutorial part is awesome. Shows what does what really clearly and simply even for those who have no clue about C#, Unity or OOP altogether, such as myself.

  • @XxXKobalXxX
    @XxXKobalXxX 4 года назад +1

    If anyone else missed it at 6:10. If you are missing the SAMPLES part in the animation window, just press the gear on the right side of the tab, and click show sample rate!

  • @garazul4291
    @garazul4291 4 года назад +20

    Best tutorial on this EVER! - Would be cool to turn this into a series, building a Megaman game step by step :-)

  • @AC-cb1oe
    @AC-cb1oe 5 лет назад +3

    this is a great tutorial. almost every other teacher out there skips important steps and clicks around too fast without explaining all the details of what is going on. So far this is the best. I will be watching more. thanks

  • @therealmegabros
    @therealmegabros 5 лет назад +18

    Great tut, I'm an artist and a beginner dev. After a month of searching I've found a clear concise tutorial. Thanks for the help !!

    • @LostRelicGames
      @LostRelicGames  5 лет назад +2

      Mega Bros, you made my evening! Thanks for stopping by, keep it indie!

  • @jeremyseay
    @jeremyseay 4 года назад +2

    I learned more about Unity from watching this tutorial than I have in the several other tutorials I've watched. 10/10

  • @Tofu-yp6so
    @Tofu-yp6so 4 года назад +1

    If some people are still having trouble with the ground check, you can just use a collider and us
    void OnColliderEnter2D(Collision collision)
    {
    if(collision.collider.tag == "Ground"){
    isGrounded = true;
    }
    }
    and vise-versa

  • @backflipbro790
    @backflipbro790 4 года назад +2

    The best 2d movement tutorial i've ever seen. Clear, fairly concise, and the best movement i've seen on youtube. Great tutorial!

  • @CreepyUncleIdjit
    @CreepyUncleIdjit 4 года назад +32

    23:30 had me laughing. Needed that after ripping out what's left of my hair.

  • @TheLastVicaris
    @TheLastVicaris 4 года назад +1

    This video came a day before my birthday a year ago and now the only think I can think of is I could have started that day... but man, without you I don't think I could have started off with the right foot now, I just reconciled with making videogames thanks to you.

  • @FratNightGaming
    @FratNightGaming 4 года назад

    I've only watched a few tutorials of yours, but you are by far the best teacher of Unity I've come across. You go over details and explain in a way that non-technical gurus can understand. I"m so excited to watch all of your vids. Subscribed!

  • @LostRelicGames
    @LostRelicGames  5 лет назад +25

    If your player is not jumping, try moving your ground check object lower. Also Come chat on discord! discord.gg/yeTuU53

    • @Harry_Holliday
      @Harry_Holliday 5 лет назад

      Hey, I know this is a little late but I thought it might be worth noting that it is better to receive inputs in the update method and then call what we want it to do when we hit the key in the fixed update as otherwise we can "miss" inputs from the player, but we also wouldn't want to have everything in update for the reasons you already explained in that it is a physics-based game. keep up the good work with your videos :)

    • @kirbotherapto2255
      @kirbotherapto2255 4 года назад

      What version of visual studios are you using?

    • @Harry_Holliday
      @Harry_Holliday 4 года назад

      @@kirbotherapto2255 it looks like visual studio 2017 and likely community version, though if you are new just use whatever is a stable release 2017 still fine but 2019s one seems to be fine by now

    • @Leo08x
      @Leo08x 4 года назад +1

      What if the character is still jumping in the air? I mean it's jumping on the ground but also whenever it is close to the ground, but not actually "touching" it, I wrote all of the code that you wrote and also added the 3 ground checkers, what could be the problem there?

    • @Leo08x
      @Leo08x 4 года назад +1

      Nvm, this could be kinda douchbagy but I'm gonna recommend another RUclipsr's video for doing good jumps if you're having trouble with this method ruclips.net/video/QGDeafTx5ug/видео.html&t

  • @ojtaylor2249
    @ojtaylor2249 4 года назад

    you're a genius, dude I have been watching Unity tutorials for like 2 years now and you are the best guy doing it I swear to god, your videos are better than some I paid for, thank you

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      Yo OJ, thanks man, This was actually my first tutorial, so i'm glad it holds up! Appreciate your comment and positivity. All the best to you dude

  • @sovietonionisthebestonion3805
    @sovietonionisthebestonion3805 4 года назад +21

    you can just type for jumping.
    if (Input.GetKey("space") && rb.velocity.y==0 )
    {
    rb.velocity = new Vector2(rb.velocity.x, 6);
    it's a lot easier.

    • @wlklsn
      @wlklsn 4 года назад +4

      The problem with ur code is that u also could jump without touching the ground eg. hitting a celling while jumping. Its just safer doing it with a groundcheck

    • @keventy6114
      @keventy6114 4 года назад +6

      Or set up something like a bool for isjumping, if(rb2d.velocity.y < 0 || rb2d.velocity.y > 0)
      { isjumping = true; }, then on the if for the Input.GetKey add && !isjumping

  • @user-fs1uc8yv8i
    @user-fs1uc8yv8i 4 года назад +1

    Thank you so much for this video. One of the few tutorials I could find where the guy actually takes his time to explain most of the stuff he does instead of just speedrunning it

    • @LostRelicGames
      @LostRelicGames  4 года назад

      Hey thanks a lot, glad to have you as a viewer!

  • @SmoughMoneyy
    @SmoughMoneyy 4 года назад +13

    i have a prolem with the linecast, everytime i implement the code and create the object, i cant jump anymore.

    • @markevro8827
      @markevro8827 4 года назад

      Yea same here..

    • @Stellar-Cubes
      @Stellar-Cubes 4 года назад +8

      You want to make sure that your GroundCheck empty is slightly below the bottom of your BoxCollider2D, otherwise it'll never actually be touching the ground

    • @BluePhantomStudio
      @BluePhantomStudio 4 года назад

      Use this:
      public bool isgrounded;
      void OnCollisonEnter2D(Collider 2D collison){
      if(collison.gameObject.CompareTag("Ground"){//insert Ground tag to platfrom
      isgrounded = true;
      }
      }
      //this will check make isgrounded true when touches the ground
      void OnCollisonExit2D{
      if(collision. gameObject.CompareTag("Ground"){
      isgrounded = false;
      }
      }
      //will not allow player to jump infinite
      void OnCollisionStay2D(collider2d collison){
      isgrounded = true;
      }
      }
      //it will allow player to jump if between two platform
      Then insert isgrounded boolean to jump input

    • @durgam_sumerian7815
      @durgam_sumerian7815 4 года назад +1

      Instead of all Ground layers and groundCheck gameobject & layermask etc..just write this code for jumping section:
      if (Input.GetKey("space") && Mathf.Abs(rb2d.velocity.y)< 0.001f)
      {
      rb2d.velocity = new Vector2(rb2d.velocity.x, jumpForce);
      animator.Play("Player_jump");
      }
      // jumpForce just a float variable I used.

    • @qqq9542
      @qqq9542 4 года назад +1

      @@Stellar-Cubes THANK YOUUUU. Solved the problem for me!!! :)

  • @pianoatthirty
    @pianoatthirty 2 года назад

    All I wanted was a tutorial that showed me how to get my animations and graphics on screen and moving/jumping, that's it. After a few days of searching I come across this absolute gem of a tutorial. THANK YOU.

  • @VideoGameAnimationStudy
    @VideoGameAnimationStudy 4 года назад +16

    Hmm, I keep getting a warning return as :
    Assets/Scripts/PlayerControllerV2.cs(14,15): warning CS0649: Field 'PlayerControllerV2.groundCheck' is never assigned to, and will always have its default value null
    So, it thinks my Transform groundCheck isn't referencing anything?

    • @dr.jackshephard4733
      @dr.jackshephard4733 4 года назад +3

      Serialized Private fields, like groundCheck in this code, will always give this warning as you assign the value in the inspector, not in the code, so the code doesn't know it has already been assigned. Feel free to completely ignore this.

    • @Moneybefehl
      @Moneybefehl 4 года назад +1

      i have the same problem, did you found a fix?
      Edit: you just need to initialize groundCheck with null

    • @VideoGameAnimationStudy
      @VideoGameAnimationStudy 4 года назад

      @@dr.jackshephard4733
      Thank you mate!

    • @trod146
      @trod146 4 года назад +2

      Or just ignore it.... It's not an actual error it is just your Script not being smart enough to read that you assigned it in the Inspector. It isn't gonna realize all of a sudden that the value was assigned since you didn't specify specifically in the script. Code is incredibly overly specific because it is translating into 0 and 1 for the computer to process. The computer itself can't read text it has no idea what anything you write means, it's the Code Editor itself that turns your words into binary for the computer.

    • @tobyk5091
      @tobyk5091 4 года назад +2

      Wait guys this is Video Game Animation Study

  • @fleur7472
    @fleur7472 3 года назад

    I'm almost mad how helpful this was. you're telling me I spend 4 hours trying to code it correctly and did it all over again without fail in less than an hour.....auwch. amazing tutorial thanks.

  • @oliverjoyce3768
    @oliverjoyce3768 5 лет назад +23

    This is incredibly useful, one to bookmark for sure. I always have problems getting 2D characters set up just right, but this video really points me in the right direction.

    • @LostRelicGames
      @LostRelicGames  5 лет назад +1

      I'm glad you see the value! Thanks for the comment.

  • @SunaKhei93
    @SunaKhei93 4 года назад

    Man, I love Brackeys, but this is the best tutorial if you want to fully understand how to create the basics of player movement script. Well done, Lost Relic!

  • @jocarlbasco994
    @jocarlbasco994 3 года назад

    This video helps a lot to understand how we use code and animation properly in game.

  • @Evoleo
    @Evoleo 4 года назад +1

    Far from optimal practicies, but very simple and for the most part well-explained. Just what a beginner needs!

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      Hey mate, my first tutorial actually so a little sloppy in places, with some bad habits I picked up from other material, which I've since corrected for newer video. I really appreciate the comment mate, It helps a lot! :)

    • @Evoleo
      @Evoleo 4 года назад

      @@LostRelicGames ty, I'll definitely check the new one out!

  • @NobSwitch
    @NobSwitch 4 года назад +1

    I had to watch this a second time just because the jump animation was glitching out. 10/10 tutorial.

  • @dhaarrunurmajid8485
    @dhaarrunurmajid8485 5 лет назад +7

    Thank you very much for you, I finally found a very good tutorial and added to my knowledge. I hope you get a reward for your kindness to teach all of this. I'm waiting for the next lesson

  • @manishsavkare1284
    @manishsavkare1284 Год назад +1

    "I gotta say Mega Man 3 was easily my favourite one"
    Never have I ever agreed with someone so much.

  • @let_o_lotl
    @let_o_lotl 4 года назад

    The best tutorial about 2d platformer I have come across, Thank you! Finally I am able to make a working jump with no buggy animation.

  • @SynysterSeed
    @SynysterSeed 4 года назад +6

    Man, after a long time search this is the best Tutorial I've seen!
    Instantly Subscribed.

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      I'm really glad you enjoyed it! Thanks for the comment dude

  • @gaganbindoria721
    @gaganbindoria721 4 года назад

    This is the first 30+ minute tutorial video i watched and every minute was worth it.

  • @OatmealRaisin
    @OatmealRaisin 4 года назад

    Thank you for this in-depth tutorial this is waaaaaaaay better than any video or website I've come across so far!

  • @cbyrne199
    @cbyrne199 5 лет назад +1

    Been looking for a tutorial on this for so long by far the best one I have came across. Thanks for the help :D
    Will be watching much more of your videos

  • @bangyudhie5178
    @bangyudhie5178 5 лет назад +10

    Very easy tutorial to understand ... even better than Brackeys :)

  • @monkeyspaw2548
    @monkeyspaw2548 4 года назад +1

    Thank you! Awesome tutorial!
    Did you [SerializeField] for groundcheckL & R? I don't get how those fields appeared in your Player inspector. I had to add variables similar to the Transform groundCheck we created earlier in order to get it working.

    • @belebs
      @belebs 4 года назад

      How did you do it? Player Inspector didn't even show runSpeed/jumpSpeed for me

    • @monkeyspaw2548
      @monkeyspaw2548 4 года назад

      @@belebs runSpeed needs to be a public float instead of a private.
      public float runSpeed;
      If you leave it as a private float you need to use [SerializeField]
      [SerializeField]
      private float runSpeed;

  • @jaosantos4943
    @jaosantos4943 4 года назад

    man, excelent tutorial, you do things in a way thats easy to understand. and thats something hard to find on yt. congrats

  • @guineagames1048
    @guineagames1048 3 года назад

    Wow, Point looks much clearer, I had been wondering why my pixel sprites looked much worse. Thanks!

    • @Shadhooe
      @Shadhooe 2 года назад

      Wait yours worked??

  • @lillycanlord
    @lillycanlord 4 года назад

    Outshines any other tutorial in YT. Thanks for helping learn even with a year and a half old video!!!

  • @thomasjensen9581
    @thomasjensen9581 5 лет назад +3

    This seems like a really great tutorial! Ive set Up some 2D controllers before but its always useful to watch other people do it! I Hope you make more tutorials in the future :D

    • @LostRelicGames
      @LostRelicGames  5 лет назад +1

      Ha thanks Thomas! That's the thing with Unity, there are so many approaches to typical tasks like this. I remember trying many when i was first starting. I Appreciate the comment!

  • @monstermouthedits5977
    @monstermouthedits5977 3 года назад

    thanks SO much, you helped me understand coding better than any tutorial so far

  • @novaplum1617
    @novaplum1617 4 года назад

    Fantastic. I actually wanted to learn HOW to program a basic 2D character controller, not just download a pre-made one and run it. This helps out a lot when it comes to getting started with that. Thanks so much for the information.

  • @rumuco
    @rumuco 2 года назад

    I just watched another video about character movement but it feels wrong in many ways that now make sense. Love your content!!

  • @r.p.stardust4010
    @r.p.stardust4010 4 года назад +3

    My code was working up until 35:46 and I am not able to jump anymore can anyone help me out?

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      Try moving your ground check game object down (so it sits below the ground line).

  • @bernardlemay8563
    @bernardlemay8563 3 года назад

    Thank you so much for sharing your knowledge. Binge watching your content these days. I really like your take on things.

  • @antonovdmitry7474
    @antonovdmitry7474 4 года назад +10

    PLS HELP!!
    Assets\Scripts\PlayerController2D.cs(14,15): warning CS0649: Field 'PlayerController2D.groundCheck' is never assigned to, and will always have its default value null
    Even Though i dragged The GroundCheck Empty to a link, checked if there are some mistakes in the script.. Everything is fine, but still the same mistake
    Cant fix it for hours! pls help((

  • @LilyRuns
    @LilyRuns 4 года назад

    Even though i'm basically just ctrl+c ctrl+v your code with extra steps still helped me learn a lot, Thank you

  • @legndarypigypow3434
    @legndarypigypow3434 5 лет назад +2

    Best tutorial I have ever used. Everything on the tutorial was presented in Unity correctly. I am squealing like a little girl seeing my ogre dude walk.

  • @FedorMP96
    @FedorMP96 5 лет назад

    You are so unbelievably good at explaining why things are the way they are. Please keep uploading tutorials!

    • @LostRelicGames
      @LostRelicGames  5 лет назад

      man, thanks so much, that makes me happy to hear. Comments like these will 100% keep me making more.

  • @krookt
    @krookt 4 года назад +3

    5:30 "Epileptic Blinking Frenzy" Yea... that got me LMAO

  • @ilan_mittelman
    @ilan_mittelman 5 лет назад +1

    THIS is a good tutorial, much better than a lot of big chanels that make the same.

  • @greatgardna2589
    @greatgardna2589 5 лет назад +1

    What an awesome tutorial! I am developing also a Megaman project in my free time and your videos are really easy to follow. Thanks a bunch!

    • @LostRelicGames
      @LostRelicGames  5 лет назад +1

      Glad you liked it, and welcome to the discord! Hope to chat about mega man more in the future! :)

  • @markevro8827
    @markevro8827 4 года назад

    I've been stuck for ages but this was a breakthrough. Really good stuff

  • @foreducationpurposes6091
    @foreducationpurposes6091 5 лет назад +6

    I started looking into unity as of recently and I was really looking for a video like this, that lets me actually understand the coding behind the character controller itself. The linecast was a really nice addition to learn, and everything was so simple and on point that even my dumbass could understand. Every person starting in unity needs to watch this. Subbed

    • @LostRelicGames
      @LostRelicGames  5 лет назад

      Thanks so much for your feedback! I'll continue refining the teaching process further - talking through ideas and decisions, not just blindly typing them like man do. Welcome to the channel! Here's an invite to the discord if you ever need to discuss the tutorials or game dev in general: discord.gg/yeTuU53

  • @risingmermo
    @risingmermo 4 года назад

    THIS IS AN AMAZING VIDEO TO WATCH FOR BEGINNERS! IT HELPS WITH THE BASICS. I CAN'T BELIEVE IT

  • @RavenCroftLoft
    @RavenCroftLoft 4 года назад +3

    My dude I love this, yea brackeys seems like hes had a hard time keeping up with new changes, he is more about marketing new features. You have arrived at an opportune time in my opinion. Loved the video and it helped me really get my game started.

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      Hey thanks man, I really appreciate it ay. And I do agree that most channels are glossing over the details. Glad you enjoy the format! All the best on your game dev journey.

  • @GokdenizCetin
    @GokdenizCetin 5 лет назад +1

    Best Unity tutorial so far! Can you do more tutorials please? Like shooting, grabbing, inventory system, game menu, game over, settings tab, skills tab etc...

  • @Geoeg
    @Geoeg 4 года назад

    Thanks to this video i finally understood the basics of animation , thanks a lot.

  • @seebobeebo
    @seebobeebo 4 года назад

    Idk how you have the answer to every problem but you are a god

  • @corbansmith9081
    @corbansmith9081 4 года назад

    Thanks so much for this tutorial! I'm making my first game in unity and this is very helpful and well explained.

  • @Rollyourown1
    @Rollyourown1 4 года назад

    Thank you!! I've learnd very much with this video! Best Tutorial I found on RUclips for Animating and Controlling an Charakter!!!

  • @pokefanover900000000
    @pokefanover900000000 4 года назад

    Hearing your victory screech after getting the code right......... That spoke to me, mannnnn LOL

  • @glassystudio
    @glassystudio 5 лет назад +2

    My chatacter plays all the animation at the same time.. like when i jump it plays both idel and jump animation, and if i press a or d while jumping it plays three animation at the same time,m

  • @jaosantos4943
    @jaosantos4943 4 года назад +1

    what i used to do the ground check was:
    if (rgb2d.IsTouchingLayers(LayerMask.GetMask("ground"))){}
    dont know if it have bugs later on, but i find it easier to understand. :D

  • @stellarestuary589
    @stellarestuary589 4 года назад

    Great video! I'm making a Mega Man Zero style game and this helped me understand how to manipulate the PlayerController somewhat to replicate the feel of specifically Mega Man Zero 3, which I'm playing at the moment.

  • @MrWelloff05
    @MrWelloff05 5 лет назад +3

    I've followed your instructions as close as possible but I keep running into
    "Warning CS0649 Field 'PlayerController2d.groundCheck' is never assigned to, and will always have its default value null Assembly-CSharp"
    Please help me!

    • @MrWelloff05
      @MrWelloff05 5 лет назад

      Also I am able to see the left & right run and jump animations, but my character is Running in-place.

    • @EricR971
      @EricR971 5 лет назад

      same here :/

    • @reecemarshall8771
      @reecemarshall8771 5 лет назад

      45:53

  • @kyleheiss5980
    @kyleheiss5980 4 года назад +1

    Thank you so much for this tutorial! It really helped me to understand a lot of the concepts. The only thing im not totally getting is the jumping, is there any way you could do a more in depth tutorial on it? Maybe making a whole jumping system for like a double jump or something. Either way love what you're doing and cant wait to go through your other tutorials!

  • @carlosabunassar6318
    @carlosabunassar6318 4 года назад

    THIS IS IT, Thank you very much man, keep doing tutorials, we appreciate it

  • @reimanas
    @reimanas 4 года назад +3

    I did the part of the ground check, and I got all the programming alright too (I've checked it twice). When I press the jump button nothing happens, as the ground check thinks I'm not grounded. Someone can help?

    • @reimanas
      @reimanas 4 года назад

      in 35:32 of the video

    • @Kaoji
      @Kaoji 4 года назад

      @@reimanas Having the same issue, the character doesn't jump when I put in the if statement

  • @zekiozdemir420
    @zekiozdemir420 4 года назад

    Were looking for this tutorial all day

  • @zuhail339
    @zuhail339 4 года назад

    Oh man I've been awaken for whole night , I tried grasping basics of unity , now I'll work on C# for few hrs as I've already some experience in OOP from C++, I don't think C# will be a trouble

  • @EricR971
    @EricR971 5 лет назад +4

    "Assets\Scripts\PlayerController.cs(15,15): warning CS0649: Field 'PlayerController.groundCheck' is never assigned to, and will always have its default value null"
    it is assigned, did someone have a similar problem and got the answer?
    btw amazing tutorial

    • @LostRelicGames
      @LostRelicGames  5 лет назад

      Did you solve this? If not here is an invite to the channel discord. I can help you better there! :)
      discord.gg/wdWfKZV

    • @lexonbee
      @lexonbee 5 лет назад

      Did you fix this? Because I have also encountered the same problem and I'm quite stuck.

    • @senseoffender9655
      @senseoffender9655 4 года назад

      @@lexonbee I'm having this issue aswell, right now :s Did you fix this in the meantime perhaps? i was ok up untill that groundcheck. gdmn groundchecks..

    • @lexonbee
      @lexonbee 4 года назад

      @@senseoffender9655 no i just quit unity

  • @usinakenes
    @usinakenes 5 лет назад +12

    Great tutorial, helped me a lot! I have a question though, so I would really appreciate if someone out there could help me out.
    So when you jump from the ground under a low platform, sometimes it jumps immediately after the grounchecks meet the platform; which i think is not a great player experience in my project. (Check 43:53 to see a visual example of it) I want my character to land first, then jump. How can I avoid the immediate jump to happen? Thanks in advance!!!

    • @urgian
      @urgian 5 лет назад +4

      You can make a cooldown to jump after landing. Add the "wasJumping" (false by default) variable, which becomes true after the jump start. While it is true, the character cannot jump again. Then add to the successful ground check the "wasJumping" variable check and if it is true, then turn on the independent cooldown and at the end make "wasJumping" false.
      I have not tested this in practice. :)

    • @urgian
      @urgian 5 лет назад +3

      Or if you want your character to not jump without pressing a button again:
      then use GetKeyDown instead of GetKey to jump.

    • @usinakenes
      @usinakenes 5 лет назад +3

      @@urgian Yep, GetKeyDown was the thing I was searching for! Thank you so much.

  • @coderaven1107
    @coderaven1107 Год назад

    Knew a lot of it, but flipX was new to me. Thanks 👍

  • @RhythmandPixels
    @RhythmandPixels 5 лет назад +1

    Excellent tutorial! I'm coming from GameMaker Studio and this answered lots of questions :)

    • @LostRelicGames
      @LostRelicGames  5 лет назад +1

      Glad to hear it! New series starting soon so stick around! :)

  • @floatingchimney
    @floatingchimney 4 года назад

    At 22:14, why are you checking for input in FixedUpdate? Isn't that against the Unity recommendations?
    As far as I understand checking for input in FixedUpdate may cause your key strokes not to be recognized sometimes.

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      Absolutely. This was one of my early tutes, a few mistakes here and there. Input checks should most certainly be done in input.

  • @matildavargasaignasse2743
    @matildavargasaignasse2743 4 года назад

    Really love this tutorial. One of the best ones I have ever seen.

  • @declans3767
    @declans3767 4 года назад +3

    Once I finished all the animations and movement, my desktop's power cord decided to come unplugged. Nothing saved

  • @goldiv
    @goldiv 4 года назад

    Proper work my friend, thank you for your efforts on these tutorials.

  • @rafotrarran6888
    @rafotrarran6888 4 года назад

    Hi at around 42:40 you can see that the player gets stuck on the side of a wall when pressing the run into it, this is happening in my project as well. Unfortunately the solution only works if you want to make a one way platform rather than a platform the player can not jump through. How would you prevent the player from getting stuck on the side of a platform that they cannot jump through?

  • @Ray-lh3oc
    @Ray-lh3oc 5 лет назад +1

    This help lots thanks so much for tutorial i learn so much from it! I love ur sense of humor and your games! defentialy subbed!

  • @sinistergeek
    @sinistergeek 4 года назад

    Apericiate Your work as beginner hay wire while creating movement this helped....It's in depth ...!!Thanks man

    • @LostRelicGames
      @LostRelicGames  4 года назад +1

      You are welcome! my pleasure

    • @sinistergeek
      @sinistergeek 4 года назад

      @@LostRelicGames Hey man!! I had lil trouble.
      Well My tile isn't one so i have put it on GameObject called Tiles!!
      Now here is the problem..when i tries to jump the play it won't buzz a inch!!
      Well my character left , right movement is work when i play
      ------------------------------------
      c0de
      ----------------------------------
      if(Physic2D.Linecast(transform.position, GroundCheck.position, 1

  • @TheZamirOrion
    @TheZamirOrion 4 года назад

    Great tutorial! Very clear. I'm bookmarking this as a reference for sure.

  • @KalponicGames
    @KalponicGames 4 года назад +1

    you should do
    private bool IsGrounded() {
    RaycastHit2D raycastHit2d = Physics2D.BoxCast(boxCollider2d.bounds.center, boxCollider2d.bounds.size, 0f, Vector2.down, 1f, platformsLayerMask);
    return raycastHit2d.collider != null;
    }
    to check the ground instead of the game object. No complications with this approach

  • @DimeF1
    @DimeF1 5 лет назад +3

    Hey, I've been following the tutorial good so far, I'm stuck now, theres these 2 things that happen to the player
    1) the player has some sort of weird physics to it, as soon as he starta climbing a ramp of about 45 degrees, he rotates and falls on the ground
    2) the ground check thing Doesn't work for me, sorta, My player can't Jump at all.
    If you could answer My questions, I would be very thankful!

    • @DimeF1
      @DimeF1 5 лет назад +1

      so, a litle update, I fixed the 1) by locking the player on Z axis, and for 2), i managed to make it jump, but it can jump as much as it wants, here's the console error if it can help you with solving this
      : PlayerController2D.cs(12,15,12,26): warning CS0649: Field 'PlayerController2D.groundCheck' is never assigned to, and will always have its default value null

    • @LostRelicGames
      @LostRelicGames  5 лет назад

      @@DimeF1 nice work solving rotation issue. The error in the console suggests the ground check object is not assigned in the property inspector, this could be something i missed in the video.
      In your scene, with player selected, find the ground check nodes and drag them to the player script, into the ground check fields.
      You will need to assign the left, middle and right ground check.

    • @EricR971
      @EricR971 5 лет назад

      @@LostRelicGames the ground check object is assigned in the property inspector, you didn't miss it in the vid but I am still getting the same error

  • @pascalinefonteh8109
    @pascalinefonteh8109 4 года назад

    I love the way you sound so excited when you get him to skate across the platform:o)>

  • @speed_hacks1337
    @speed_hacks1337 5 лет назад +2

    Hey, I have problem, if player key jump and isGround true , my player cant jump, maybe it didnt detect the groundCheck whenever it collides with Layer Ground, what should i do ?

    • @DimeF1
      @DimeF1 5 лет назад

      Same happening to me, don't know what to do, getting frustrated, if you find a solution, please let me know :)

    • @TheRecca07
      @TheRecca07 5 лет назад +2

      i moved the box collider up a bit from the bottom and it worked somehow

    • @namessis
      @namessis 5 лет назад +2

      (Physics2D.Linecast(transform.position, GroundCheck.position, 1

    • @namessis
      @namessis 5 лет назад

      lines must reach ground layer to work successfuly

    • @mevgdev
      @mevgdev 5 лет назад

      @@TheRecca07 is it correct, I had the same problem, but I move the collider a few millimeters more down, and working correctly.

  • @stephanielim2841
    @stephanielim2841 4 года назад

    Thanks a lot! I love how you did this from scratch and how people can easily take this and customize it and make it their own. :)

  • @shreyas908
    @shreyas908 4 года назад

    i really liked your way of teaching please don't stop!!!! keep on going!!

  • @jamilamini7807
    @jamilamini7807 5 лет назад +1

    your channel will have 1 million subscribers very soon keep the great work up nice tutorials

    • @LostRelicGames
      @LostRelicGames  5 лет назад

      Haha I wish! Thanks so much for the positive comment, new one this weekend hopefully!

  • @mcnuggers5380
    @mcnuggers5380 3 года назад +2

    I’ve been following everything you did in the tutorial, but after I added the ground check thing my character suddenly won’t jump anymore and the run animation won’t work either. What did I do wrong? Note: i fixed it already

  • @crimsonembers8741
    @crimsonembers8741 3 года назад

    Thanks so much for the help I now feel ready for my first unity jam (I'll try to remember to reply to this comment to say how it went)

  • @michaelerickson5437
    @michaelerickson5437 3 года назад

    35:09 I've followed the tutorial step-by-step here and after this moment the jump function no longer works. Any common reason/ mistakes made for this?

    • @LostRelicGames
      @LostRelicGames  3 года назад +2

      Hey mate, try move the ground check position lower so it sits below the ground. Also make sure the ground game object has been assigned a layer named Ground.

    • @michaelerickson5437
      @michaelerickson5437 3 года назад

      @@LostRelicGames moving the ground check lower worked. Thanks for your help much appreciated!

  • @janfeyen592
    @janfeyen592 5 лет назад

    Hey guys, great, concise explanation towards making a comfortable movement. Anyone here getting any issues with animation modifications? the spliced sprites aren't recognized when trying to make animations

  • @animatedkaijuice259
    @animatedkaijuice259 3 года назад +1

    I don't know why but even with the ground check-in place exactly as in the video the character still jumps when I hold down and/or spam space

  • @Wiffos
    @Wiffos 5 лет назад +2

    Whenever i put the && isGrounded in (Input.GetKey("space") && isGrounded ) i can no longer jump. Help would be appreciated.