2D Movement in Unity (Tutorial)

preview_player
Показать описание
Let’s give our player some moves!

····················································································

········································­­·······································­·­····

► All content by Brackeys is 100% free. We believe that education should be available for everyone.

········································­­·······································­·­····

♪ "ES_Freekin'_Fretless_3" - Mattias Andreasson" by Epidemic Sound
♪ "ES_Dress Code_Black - oomiee" by Epidemic Sound
Рекомендации по теме
Комментарии
Автор

All hail lord Brackeys. You will be missed.

Mistbu
Автор

Usually I like your tutorials, but this one isn't great. It doesn't really teach how to do 2D movement, and rather teaches how to use a pre-made script, so in the end nothing about the movement is learnt, other than the inputs. A follow-up video on creating the actual script that does the movements would be useful to people learning, as it'd let them play around with their own ideas, instead of being limited to the pre-made script.

sink
Автор

Me: Copies exactly everything
Unity: Can I offer you 300 compiler errors?

thepizzafoogle
Автор

"and know our character should be able to walk."

My Character during the Game Jam: best i can do is spin.

ItsMeHoodson
Автор

me: do everything correctly
unity: *n o*

someidiotontheinternet
Автор

I'm glad he explains where all of the variables are and what they do. Someone who wants to write code but can't type very fast can know when they are required to put an "arachibutyrophobia" in the code or when they can simply put "r." Super clear too. Thanks!

thenecromancer
Автор

Hey everyone, if you are having some issue with crouch, the script provided in the discription has an error. To solve that, just open with your editor and go to line 67 (it is an if(!crouch) state) and remove the '!' on that line. The reason to do this is that is that the original check - if(!crouch) - is checking if player IS NOT crouching, and then set it to true. We don't want that. In fact, we want to know if player IS crouching. I hope this can help anyone else! Great tutorial though!

dufwine
Автор

for those who are having a problem with the player clipping through the floor when releasing crouch button under an object,
you need to edit the CharacterController2D script line 67(!crouch) change it to (crouch) to check if the player IS crouching AND line 64 the Move method you need to remove the first if statement. it basically means its only checking if there is an obstacle above you ONLY when you are pressing the crouch button which wont keep the collider disabled when you release the crouch. However when you remove the if(crouch) the first one in the Move method, it will check if there is an obstacle above you whether you are pressing down the crouch or not. meaning even when you release the crouch button it will STILL check is there an obstacle above you and therefore prevent the player from unchrouching until there is no obstacle above you.

reaper_artwave
Автор

//Wow, that's the cleanest desktop I've ever seen.

isaiah
Автор

For those of you still having trouble with your character falling through the ground, set a Tilemap Collide 2D to your tilemap

MrButterGuy
Автор

me: does everything he said
unity: nono we dont do that here

anchovy
Автор

my boy big brack still helping me even after the channel ended...

im_skrunkly
Автор

I have used you for literally every step in my game dev journey, you are literally so good and useful. You make everything seem so easy

jazzallen
Автор

For those that are having the problem of not being able to jump, make sure that your GroundCheck is on the actual ground rather than on the bottom of the player.

mrkathooloo
Автор

My favorite parts of your tutorials is when:
1) you do something
2) I ask "... but why..?"
3) you go on to something else, and then
4) come back and answer my question.

ichifish
Автор

if your character does a small bounce when you move on a flat surface try adding composite collider and add use composite onto the other collider, took me 8 hours to fix so ill save you some time

BoxChicken
Автор

Here’s some problems i faced and solutions i came up with.

Player falling through floor / Rigid floor
- Use TileMap Collider component on tilemap

Couldn’t Move
- Noticed my player was stuck in mid air, turned on air control to fix

Couldn’t Jump:
- Again due to player being stuck in mid air, and you can’t jump unless you are touching the ground. Noticed my ceiling and ground check were mixed up. Rearranged them and fixed the issue. (The ceiling check and ground check steps are required for jumping to work)

Couldn’t Crouch
- Go into the Character Controller script and press F3 or CTRL + F to use the “find” tool. Type in “!Crouch” (make sure it’s not case sensitive) and edit out that exclamation point.

FREEGEMS
Автор

For anyone struggling with the player still falling through the ground, add a component (box collider 2D) to your terrain. It's the fastest way possible to do it and Brackeys didn't show it on his video. Hope it helped!

Ithee_The_Fox
Автор

Turns out this set of colliders has weird interaction with platform effectors. The character can land on a platform with bottom side of the box while circle still ignores collision. If you are going to use platform effectors, replace the box with a vertical capsule collider full height long.

SMT-ksyp
Автор

Man, thank GOD I found this channel.
sad they are no longer plublishing videos anymore, but everything here is just SO HELPFULL!!!!
Thanks guys, you've made an awesome job and learning developers around the world salute you!

Edgard