2D Player Movement In Unity

  Рет қаралды 452,764

bendux

bendux

Күн бұрын

Пікірлер: 2 100
@ErraticPulse
@ErraticPulse Жыл бұрын
Fun Fact, if u look at some of the areas on the script window you will notice that the language is in german
@animated_aviation
@animated_aviation 9 ай бұрын
yes I found out
@Luigi_Guy21
@Luigi_Guy21 3 ай бұрын
Jaja das hast du gut gesehen
@serhanbozkurt3008
@serhanbozkurt3008 3 ай бұрын
@@Luigi_Guy21 shut up
@leonzuendel123
@leonzuendel123 7 ай бұрын
The video would be a lot better if you'd actually explain WHY you do certain things instead of just telling us THAT you're doing it. Could have just provided the source code without a video at this point (for the most parts).
@ericantone8709
@ericantone8709 3 ай бұрын
this is the biggest mistake online unity tutorials make. they never explain why things work the way they do.
@magnusman
@magnusman 3 ай бұрын
Exactly!
@marik996
@marik996 Ай бұрын
I agree
@ghostreaper8876
@ghostreaper8876 Ай бұрын
Whomp Whomp jk I agree
@fluffystuff
@fluffystuff 2 жыл бұрын
as a complete beginner. I did not understand this video very well but after a few weeks of messing around in unity and i can finally understand what is in this video
@Externium
@Externium Жыл бұрын
Yeah what in the world is going on here ._.
@Skitozzz
@Skitozzz Жыл бұрын
@@Externium :)
@FireGloves
@FireGloves Жыл бұрын
If anyone's wondering why they can't jump, the "jump" key is set to space by default. To change it to something else, here's the code. if (Input.GetKeyDown(KeyCode.UpArrow) && IsGrounded()) { rb.velocity = new Vector2(rb.velocity.x, jumpingPower); } if (Input.GetKeyUp(KeyCode.UpArrow) && rb.velocity.y > 0f) { rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * 0.5f); }
@Bigblackhawk123
@Bigblackhawk123 Жыл бұрын
It doesn’t work even if I press space though 🫤
@dalegacy2877
@dalegacy2877 Жыл бұрын
@@Bigblackhawk123You definitely done something wrong then. I had the same issue until I linked all the objects. Try watching the video multiple times to understand what is actually going on rather than saying it doesn't work. :)
@zanahtile6276
@zanahtile6276 Жыл бұрын
Check if your Ground Check is actually "grounded". If you create it first, it places the object in the middle of the player, this causes it to never touch ground. And results in failing the ground check and blocking you from jumping. Move it lower on the player.@@Bigblackhawk123
@swiniapierdek
@swiniapierdek 11 ай бұрын
omg thank you I haven't knew that.
@TheGreyCat1026
@TheGreyCat1026 10 ай бұрын
that was the problem, thanks!@@zanahtile6276
@deilruchi
@deilruchi Жыл бұрын
If your character is moving left and right but doesn't jump after finishing tutorial you might have missed the point where he moves Ground Check object early in the video closer to players feet and ground. 🎉
@joshpreston4957
@joshpreston4957 Жыл бұрын
Been working on this issue for literally weeks, bless you wise internet stranger!
@deilruchi
@deilruchi Жыл бұрын
@@joshpreston4957 Glad it helped you, because it took me a while as well.
@mariazia221
@mariazia221 Жыл бұрын
where
@deilruchi
@deilruchi Жыл бұрын
@@mariazia221 kzbin.info/www/bejne/gWLbi2CorsiMj5o
@Garfield_Minecraft
@Garfield_Minecraft Жыл бұрын
OMG thank you god it's been 3 hours just sitting here what went wrong
@guyinaraincoat4292
@guyinaraincoat4292 Жыл бұрын
This tutorial was very helpful by showing the whole process of making the script that made the character move, Thank you!
@mitchelllockyer7541
@mitchelllockyer7541 Жыл бұрын
bippity boopity your code is now my property
@JoeMotions-cj1ji
@JoeMotions-cj1ji 2 ай бұрын
drink your milk🥛 boiiiii
@AsianUploads
@AsianUploads Ай бұрын
@@JoeMotions-cj1ji Aint he Lookin KIndaa THICC
@The_Gronne
@The_Gronne 2 жыл бұрын
This is probably the best programming tutorial I've ever seen. Extremely easy and to the point. And for someone who's done this multiple times in the past, but simply don't want to type it all out again, linking the source code makes everything so much easier.
@notwasnttaken
@notwasnttaken 2 жыл бұрын
Mee too, i give it 100/100!
@monkeypwners
@monkeypwners Жыл бұрын
Very nice video, easy to follow! I just feel like you go over some stuff without explanation, which can make it difficult to understand why we do what we do, like Collision Detection, Sleeping mode and interpolate. I have no idea what it means, but I just do as you say and it works :) Great video overall tho! Big props!
@schauerv
@schauerv 2 жыл бұрын
God tier tutorial, finally something that is short and works great instead of an 18 min video that bugs out!
@Skitozzz
@Skitozzz Жыл бұрын
Fr fr
@its_a_gamer5279
@its_a_gamer5279 2 жыл бұрын
For everyone that struggles with the player falling through the ground, Make sure that your ground is not imported from a file but made in the 'Hierarchy'. (if its not imported its grey in the hierarchy otherwise its blue) Good luck!
@bendux
@bendux 2 жыл бұрын
Thank you for sharing!
@its_a_gamer5279
@its_a_gamer5279 2 жыл бұрын
@@bendux np!
@wogs2k
@wogs2k 2 жыл бұрын
I did this and it still doesn't work
@bendux
@bendux 2 жыл бұрын
@@wogs2k Join our Discord server, and let's solve your problem together!
@sirnoodle2004
@sirnoodle2004 2 жыл бұрын
@@wogs2k Also make sure that on both the BoxCollider2D of the player and the platforms, the box "Is Trigger" is not ticked
@Skylar.H93
@Skylar.H93 Жыл бұрын
Amazing, I was able to figure it out from the video with only like 2 errors that were extremely easy to solve. Superb video! Now I just gotta figure out how to make magic fist attacks with effects, determine a combo system, and design and figure out how to link side profiles to the player sprite with walking animations.
@bendux
@bendux Жыл бұрын
I'm glad I could help. Good luck!
@LucaThePupineer
@LucaThePupineer 10 ай бұрын
HOW THIS FEELS IMPOSSIBLE
@Arrzee.
@Arrzee. Жыл бұрын
Here is the script for those who need it using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { private float horizontal; private float speed = 0f; private float jumpingPower = 16f; private bool isFacingRight = true; [SerializeField] private Rigidbody2D rb; [SerializeField] private Transform groundCheck; [SerializeField] private LayerMask groundLayer; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { horizontal = Input.GetAxisRaw("Horizontal"); if (Input.GetButtonDown("Jump") && IsGrounded()) { rb.velocity = new Vector2(rb.velocity.x, jumpingPower); } if (Input.GetButtonUp("Jump") && rb.velocity.y > 0f) { rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * 0.5f); } Flip(); } private void FixedUpdate() { rb.velocity = new Vector2(horizontal * speed, rb.velocity.y); } private bool IsGrounded() { return Physics2D.OverlapCircle(groundCheck.position, 0.2f, groundLayer); } private void Flip() { if ((isFacingRight && horizontal < 0f) || (!isFacingRight && horizontal > 0f)) { isFacingRight = !isFacingRight; Vector3 localScale = transform.localScale; localScale.x *= -1f; transform.localScale = localScale; } } }
@wizard7317
@wizard7317 Жыл бұрын
yo, my serialized fields arent showing up in my unity project and i was wondering if you could help
@noona7701
@noona7701 Жыл бұрын
@@wizard7317 did u save the script in vs before going back to unity?
@furyz0339
@furyz0339 Жыл бұрын
this script gives me no movements :c i turn left and right but cannot move
@noona7701
@noona7701 Жыл бұрын
@@furyz0339 you have to change the speed in vscode to 8 (in the comment it is set to 0)
@furyz0339
@furyz0339 Жыл бұрын
thank youuu @@noona7701
@yugnatata
@yugnatata 7 ай бұрын
Thank you! I spent over 10 hours trying to do this and you showed me how to in 5 minutes, it's perfect! Just had to be a little careful as you didn't say out loud everything you were saying, but it's otherwise an amazing video, and still up to date! Thanks again!
@GD-Monkey
@GD-Monkey 4 ай бұрын
This is the only tutorial where I get good physics for the player, thanks so much :)
@lemason5981
@lemason5981 Жыл бұрын
that ground checking system is simplistic brilliance, I was stuck for hours trying to think of that and in this moment i am hoping that you're a wizard and it's not just some super simplistic thing everyone has been doing for ages except me
@bendux
@bendux Жыл бұрын
Haha, I'm definitely not a wizard.
@NewSunnahAcquired
@NewSunnahAcquired 5 ай бұрын
@@bendux thats exactly what a wizard would say
@matsu4721
@matsu4721 2 жыл бұрын
Thanks for this awesome smooth moving video, but can you do 2d enemy ui or shooting?
@bendux
@bendux 2 жыл бұрын
I've added it to my list. Thank you for the suggestion!
@ZephyrAnimationss
@ZephyrAnimationss 2 жыл бұрын
@@bendux YEsssssss exactly what i wanted thanks(i want to make a shooter game cuz im new)
@enderpigerdragon3589
@enderpigerdragon3589 Жыл бұрын
Thanks for the awesome 2D movement in Unity tutorial! Super helpful! 👍
@c0rse198
@c0rse198 Жыл бұрын
After 3 hours of attempting to figure out why I wasn't able to jump, I found that you need to assign your keys to the "Jump" input in input settings. While horizontal is pre-set, jump is left blank and this left me absolutely baffled until I figured it out.
@debramciver307
@debramciver307 Жыл бұрын
HELP PLEASE
@kidthelett
@kidthelett 7 ай бұрын
Beautiful. Kinda funny I thought the jump didn't work cause i was pressing w or the up button, but then i realized it was space
@JustSplatoonGameplay
@JustSplatoonGameplay Жыл бұрын
Hey! Just wondering, if we want to animate, what boolean or Float should i use for the transition?
@mangmoommoommoom2000
@mangmoommoommoom2000 6 ай бұрын
Yeah bro I was about to ask tha’
@alexwellman6605
@alexwellman6605 2 жыл бұрын
I have a problem with the movement, I added the no friction material to two objects, but after they collide, they start getting stuck on the floor, even after moving and jumping The floor uses tilemap colliders, if that helps Edit: probably solved, I used a composite collider too
@bendux
@bendux 2 жыл бұрын
Add a Composite Collider 2D component to your tilemap.
@alexwellman6605
@alexwellman6605 2 жыл бұрын
@@bendux thank you so much
@swish_tm6660
@swish_tm6660 Жыл бұрын
My face when i don’t understand 99.9999% of the code 5:33
@bendux
@bendux Жыл бұрын
I definitely want to make more beginner-friendly videos in the future.
@Apleker
@Apleker Жыл бұрын
Hippity Hoppity Your Code Is Now My Property - "Apleker"
@bondzzz
@bondzzz 8 ай бұрын
my player wont stop falling through the damn ground
@bendux
@bendux 8 ай бұрын
If you want two game objects to collide with each other, both game objects require a collider.
@kibookamc
@kibookamc 2 күн бұрын
bro add a box collider, like you did with the player
@cheezeburger7716
@cheezeburger7716 2 жыл бұрын
Very nice tutorial, one thing that I noticed, or if I may have missed, however, is that when I go to jump, the player doesn't have a limit to how many times they can jump in the air. Is there something that I would need to type in to fix that? I noticed that wasn't established in the video, but if anyone has an idea of how to put that in it would mean a lot. I'm a beginner at coding myself, so I'm not too big on this kind of stuff.
@bendux
@bendux 2 жыл бұрын
Would you like to show me your code on Discord?
@cheezeburger7716
@cheezeburger7716 2 жыл бұрын
@@bendux Oh, thank you. But I actually managed to figure it out from another source. I appreciate the offer though. And what all you had shown here in the video.
@bendux
@bendux 2 жыл бұрын
@@cheezeburger7716 I'm glad you were able to fix it.
@ab7299
@ab7299 2 жыл бұрын
@@cheezeburger7716 can you tell me how you fixed it? i want to fix it too
@aniime4006
@aniime4006 Жыл бұрын
@@cheezeburger7716 can you tell me how you fixed it? i want to fix it too
@historyjunior
@historyjunior Жыл бұрын
This is an amazing tutorial! Thank you so much, I really loved this!
@amburdo6206
@amburdo6206 2 жыл бұрын
Thanks for the great video. I wanted to ask about one thing I'm quite confused about. It seems that you didn't program any horizontal movement keys that need to be pressed down to move, yet you still are able to move. The only key you referenced in the script was jump. How is that possible?
@bendux
@bendux 2 жыл бұрын
Edit > Project Settings > Input Manager
@amburdo6206
@amburdo6206 2 жыл бұрын
@@bendux Thanks a lot!
@lilili765
@lilili765 Жыл бұрын
​@@benduxwhat do i do in inputmanager
@1ts_Leen0
@1ts_Leen0 4 ай бұрын
I struggled with the built-in input manager. No matter what I did it seemed to apply some form of deceleration/acceleration when I moved the player. So instead, I did something similar to you in this video and that fixed it. Nice and snappy movement, just as you'd expect in a 2D game.
@lennystudios3.14
@lennystudios3.14 Жыл бұрын
Love it, I personally like adding a Lerp function for some smoother acceleration and floatier physics, but that’s just my prefrance
@slayerghande7969
@slayerghande7969 2 жыл бұрын
Yo, great work here 👏. Don't ever stop and you will be the new brackeys
@vrsuhfx
@vrsuhfx 2 жыл бұрын
Hey! Quick question, how exactly would i make the run/walk a method if possible? Just so that I have a place to add in my audio, dust particles, etc. Cuz I'm new to this whole thing haha
@bendux
@bendux 2 жыл бұрын
The answer to your question goes beyond the scope of a KZbin comment, but I'd still like to help you. Join our Discord server, and let's solve your problem together!
@Nintendostar02
@Nintendostar02 Жыл бұрын
When you'll make a video about how do object follow the player (like Mario, luigi and paper mario in Mario and luigi paper jam), i'll be very happy. Great video, i resolved all my problem with 2d player movement
@bendux
@bendux Жыл бұрын
I've added it to my list. Thank you for the suggestion!
@markotafa
@markotafa 10 ай бұрын
I like people that actually put code in the despcription :)
@ThisIsStoneGD
@ThisIsStoneGD 7 ай бұрын
I want my cube when the cube is jumping while moving to the right, the cube will jump and rotate 90 degrees to the right as well and there should be a kind of animation and not just instantly changed to 90 degrees. Edit: just like in Geometry Dash
@feddyfadbear7985
@feddyfadbear7985 2 жыл бұрын
hey, great video, everything is working fine but im jumping WAY too high, how can i decrease the jump power?
@bendux
@bendux 2 жыл бұрын
Decrease the jumping power at the top of the script.
@BHArv3y
@BHArv3y 2 жыл бұрын
you can change the value in the script from "private float jumpingPower" to "public float jumpingPower" and this will allow you to directly adjust the power in unity rather than opening the script! :D good luck!
@gumball5372
@gumball5372 4 ай бұрын
@@bendux didnt do anything, is there another fix?
@bendux
@bendux 3 ай бұрын
@@gumball5372 Increase the gravity scale of your player's Rigidbody 2D component.
@gumball5372
@gumball5372 3 ай бұрын
@@bendux i found the fix, i tried this but it didnt work. I have no clue what the problem was but it works now
@LilCouve
@LilCouve 2 жыл бұрын
Thank you, this was my first time using C# and this really helped me!
@W5AKC
@W5AKC 2 жыл бұрын
Very nice and simple.
@polyhedrainteractive9663
@polyhedrainteractive9663 Жыл бұрын
This is incredible, I coded for a while but couldn't get past the basics will watch more
@travisc8406
@travisc8406 Жыл бұрын
can we just appreciate that he is still responding to comments! you're awesome!
@EmirDuman1
@EmirDuman1 9 ай бұрын
i can't jump
@finngrainger349
@finngrainger349 9 ай бұрын
neither, left and right works just no jump
@wayvoedorado71
@wayvoedorado71 9 ай бұрын
have any of you found a solution yet? It looks like it's a common problem.
@finngrainger349
@finngrainger349 8 ай бұрын
yes, my problem might be different to yours but I solved it by moving the 'ground check' to the position of the bottom of the player as I forgot to move it as said at 1:17@@wayvoedorado71
@wayvoedorado71
@wayvoedorado71 8 ай бұрын
@@finngrainger349 that wasn't my problem, but you encouraged me to look into it and my problem was that I forgot to change the platform layer to ground so thank you
@bendux
@bendux 8 ай бұрын
You probably skipped one or two important steps in the tutorial.
@krzaczastyyt6547
@krzaczastyyt6547 2 жыл бұрын
Your tutorials are the best i gona make a game with those
@RichardBarnes0
@RichardBarnes0 2 жыл бұрын
The old input system is not worth using anymore.
@lilDrizzyyy
@lilDrizzyyy Жыл бұрын
Yes it is stfu
@dmitriyleonov6977
@dmitriyleonov6977 11 ай бұрын
Отлично. Я делал подобный урок от другого автора. Персонаж дёргался. А тут всё движется плавно и код выполнен здорово компактно. Настройки физического тела показал как настроить . Спасибо за урок
@-._122
@-._122 Жыл бұрын
@bendux THIS IS THE BEST TUTORIAL EVER!!! I CAN MOVE AND JUMP btw you just earned a sub
@bendux
@bendux Жыл бұрын
Thank you!
@-._122
@-._122 Жыл бұрын
@@bendux no problem
@frogwav
@frogwav 2 жыл бұрын
You explained this well. also it works. thanks!
@VonMoosHarrison
@VonMoosHarrison Жыл бұрын
Literaly the most difficult to understand tutorial
@foo3268
@foo3268 2 жыл бұрын
underrated channel, hopefully unity notices you someday
@nagisa1578
@nagisa1578 Жыл бұрын
Man thx, did know / thought you cloud just change the velocity in script. Makes everything soooo much easyer and I dont have to fiddle around with AddForce etc. Thank you again man.
@gameormusic2360
@gameormusic2360 Жыл бұрын
bro is definitely not a beginner, Very helpful video and thank you
@-iip220v
@-iip220v 2 ай бұрын
Great! Its work but how to make mobile buttons?
@Think_Stream
@Think_Stream Жыл бұрын
thanks a lot bro i went to many videos just for this even brackys tutorial didnt work and i tried this love you bro
@iAmStanee
@iAmStanee Жыл бұрын
Brackys tutorial is where all the souls go😂😂
@gumball5372
@gumball5372 4 ай бұрын
@@iAmStanee its just really outdated
@LowGuyy
@LowGuyy Жыл бұрын
Thanks for teaching us in dark mode
@Squinglet
@Squinglet Жыл бұрын
Me: copies code Unity: haha compiling error
@bendux
@bendux Жыл бұрын
What kind of error message do you get?
@Squinglet
@Squinglet Жыл бұрын
@@bendux just says compiling error idk
@bendux
@bendux Жыл бұрын
@@Squinglet Join our Discord server, and let's solve your problem together!
@Squinglet
@Squinglet Жыл бұрын
@@bendux whats the link btw im not gonna do voice chat rn since im sick and my throat hurts even to talk
@bendux
@bendux Жыл бұрын
@@Squinglet There is a link in the description.
@Boogie-wi7hd
@Boogie-wi7hd Жыл бұрын
This tutorial was to easy to be true like how does he do so much with so less code. And not to mention its so easy to read.
@The_Real_Zoouro
@The_Real_Zoouro Жыл бұрын
Jo Gleises Video Bruder :D
@iamkennegee
@iamkennegee Ай бұрын
I could use some help regarding slopes. Much appreciated for the easy to follow tutorials!
@Xofol
@Xofol 9 ай бұрын
Hey if you dont want your player to be stuck on walls when applying the horizontal force, use the CharacterController component instead!
@bendux
@bendux 5 ай бұрын
Create a Physics Material 2D, set the friction to zero, and add it to your player's Rigidbody 2D component.
@noahprocacci8931
@noahprocacci8931 Жыл бұрын
I'm sorry but, I though I searched up "simple 2d Unity movement guid", I was was expected much easier.
@bojanmanojlovic5722
@bojanmanojlovic5722 Жыл бұрын
Like dani would say it: "Hippity hoppity, your code is now my property".
@bendux
@bendux Жыл бұрын
Don't forget to drink a lot of milk.
@waawaaaa
@waawaaaa 5 ай бұрын
For those wondering why you can't jump remember to change the layer of your platforms to ground, had me confused for a few minutes
@luccabobucca
@luccabobucca 2 ай бұрын
Thank you for making a tutorial I could follow!
@KrixerVR
@KrixerVR 7 ай бұрын
This helped me alot and I even somehow got my player to infinite jump like flappy bird. Definitally a win
@bendux
@bendux 7 ай бұрын
If you want to get rid of this behavior in the future, make sure that your player and the ground are not on the same layer.
@KrixerVR
@KrixerVR 7 ай бұрын
@@bendux Thx man, oh and btw I subbed to you for your awesome Unity tips!!
@bendux
@bendux 7 ай бұрын
@@KrixerVR I appreciate it. Thank you!
@Dooringa
@Dooringa Жыл бұрын
wow! OUR code is very efficent! Good job!
@M_BRINE_85
@M_BRINE_85 Жыл бұрын
lol
@JohnKirk-eb6nk
@JohnKirk-eb6nk Жыл бұрын
I have watched tons of tutorials, best one yet
@walterbbg6178
@walterbbg6178 Жыл бұрын
Good video but i have a problem, i cant jump can i know how do i fix it?
@bendux
@bendux Жыл бұрын
Did you position the ground check at your player's feet?
@ErraticPulse
@ErraticPulse Жыл бұрын
I have a bug where it doesnt delete the versions of itself left behind after moving
@bendux
@bendux Жыл бұрын
It probably has something to do with your camera.
@blaq6467
@blaq6467 2 жыл бұрын
It worked for a while but then just stopped "PlayerMovement' already defines a member called 'Flip' with the same parameter types"
@bendux
@bendux 2 жыл бұрын
Would you like to show me your code on Discord?
@MugStudios2024
@MugStudios2024 2 ай бұрын
This is such a great video
@bjarnelipp5626
@bjarnelipp5626 3 ай бұрын
The jumping part isnt working for me because somehow the groundcheck isnt sticking to the character..can anybody explain what to do
@bendux
@bendux 3 ай бұрын
The ground check must be a child of the player.
@EmbersShop
@EmbersShop Жыл бұрын
if you are confused on pubic, private, [SerializeFeild] private read this public = makes it so it shows up inside inspector and allows other scripts to access it private = makes it so it DOESNT show up inside inspector and DOESNT allow other scripts to access it [SerilizeFeild] private = make it so it DOES show up inside inspector BUT DOESNT allow other scripts to access it hopes this helps
@bendux
@bendux Жыл бұрын
Thank you for sharing!
@Prod_Joel-beats
@Prod_Joel-beats Жыл бұрын
What buttons do you move left and right on? I can jump but idk how to love left and right
@bendux
@bendux Жыл бұрын
Edit > Project Settings > Input Manager
@dux_2013
@dux_2013 7 ай бұрын
How do you switch the letters so i can use different letters?
@bendux
@bendux 7 ай бұрын
What do you mean?
@dux_2013
@dux_2013 7 ай бұрын
@bendux im sorry, but I meant to say how to change letters for moving so WASD can be changed to IJKL or something like that
@bendux
@bendux 7 ай бұрын
@@dux_2013 Edit > Project Settings > Input Manager
@dux_2013
@dux_2013 7 ай бұрын
@bendux thank you man
@forforref7968
@forforref7968 Жыл бұрын
Help it says vector 2 and 3 is an ambiguons reference between 'UnityEngine.Vector3' and 'System.Nuerics.Vector3'
@bendux
@bendux Жыл бұрын
Would you like to show me your code on Discord?
@forforref7968
@forforref7968 Жыл бұрын
@@bendux I've fixed the problem already but now I can't jump
@bendux
@bendux Жыл бұрын
@@forforref7968 Did you position the ground check at your player's feet?
@nulli3
@nulli3 4 ай бұрын
this'll come in handy
@jaromino77
@jaromino77 Жыл бұрын
C# in the context of Unity is so much harder to understand than anything i've dealt with :(
@unknown4133
@unknown4133 2 жыл бұрын
I've spent afew hours trying to find one that worked... a 5 minute simple video, that is simple and easy to understand; compared to a 30 minute jumbled video that doesnt even work... That red subscribe button is calling!! Thank you so much
@carlosalbertobatistacruz
@carlosalbertobatistacruz 11 ай бұрын
Nice tutorial, the SpriteRenderer Component can also be used, just get the flipX (bool) attribute, instead of using localScale -1.
@KenB1206
@KenB1206 Жыл бұрын
thank you so much, sir bendux! it help quite significantly
@pillager2327
@pillager2327 7 ай бұрын
My character still isn't able to move left and right?
@bendux
@bendux 7 ай бұрын
It's hard to tell what's going on without seeing your script.
@pillager2327
@pillager2327 7 ай бұрын
@@bendux it’s all good I figured it out
@arimailunak9343
@arimailunak9343 Ай бұрын
@@pillager2327 How did you solve it?
@Jamal38852
@Jamal38852 Жыл бұрын
You literally saved me by making this video, earned a sub
@RelaxReisen
@RelaxReisen Жыл бұрын
Danke, hat problemlos geklappt!
@Sodz1ax
@Sodz1ax 2 жыл бұрын
my player flies endlessly up
@bendux
@bendux 2 жыл бұрын
Would you like to show me your code on Discord?
@Herobetter-r4f
@Herobetter-r4f Ай бұрын
IT LITERALLLY DOESNT WORK IT JUST GIVES ME ERRORS
@mr.phewphew4971
@mr.phewphew4971 Ай бұрын
Same
@bendux
@bendux Ай бұрын
Without further information, it's impossible to help you.
@Tapov_
@Tapov_ Жыл бұрын
Thanks for the tutorial! I'm a beginner and this helps alot!
@user-ve5rr9bp3n
@user-ve5rr9bp3n 4 ай бұрын
thank you so much ,without you i would still be stuck in how to move it . you've got a sub
@beepboop2851
@beepboop2851 Жыл бұрын
Btw if u are having problems with the rub, ground check and ground layer not appearing then just copy and paste the source code in the description because I had followed all the steps and it wasn’t working but when I copied it the errors got fixed
@bendux
@bendux Жыл бұрын
The source code on GitHub is the same as in the video.
@antoniosalazar9505
@antoniosalazar9505 Жыл бұрын
Thanks, I was just looking for this.
@chrono9503
@chrono9503 Жыл бұрын
Its better to use a trigger colider instead of an empty object to check for grounded so you can change the width
@bendux
@bendux Жыл бұрын
You can adjust the radius of the ground check.
@DevNoob
@DevNoob 2 жыл бұрын
Always good videos! 1k subs let's go!
@kruziksuleyk9536
@kruziksuleyk9536 4 ай бұрын
This helped heaps thank you so much
@eshaanb2362
@eshaanb2362 5 ай бұрын
Thank you so much, this tutorial was very helpful!
@Volibs_
@Volibs_ Жыл бұрын
Nice Tutorial! I have a question though.. When you created the RigidBody rb; In the script it’s not showing up under playerMovement which means I can’t put the rigidbody into the script. What do I do?
@bendux
@bendux Жыл бұрын
Did you save the script?
@Volibs_
@Volibs_ Жыл бұрын
@@bendux Yeah. Before I left the VS Code I clicked on Ctrl S and it saved into Unity, but rb is not showing up in the player.
@bendux
@bendux Жыл бұрын
@@Volibs_ Make sure that the class at the top of the script has the same name as the script itself.
@ZakAttree
@ZakAttree 8 ай бұрын
@@bendux yea im having the same issue its not appearing under the movement part inside of the inspector and im getting an error saying invalod expression term '>'
@bendux
@bendux 7 ай бұрын
@@ZakAttree I advise you to compare your script with the source code in the description.
@DeApple_king
@DeApple_king Жыл бұрын
for some reason when i press play i get stuck to the ground even tho i added 0 friction and i cant move can u help me with that??
@bendux
@bendux Жыл бұрын
If you have a tilemap in your scene, add a Composite Collider 2D component to it.
@AreHorsesReal
@AreHorsesReal Жыл бұрын
Slight issue with something, not entirely sure why but moving left/right causes the Y value on the rigidbody's velocity to also go up, even though you're not moving along the Y axis. This messes with some jump/falling animations I have, and I can't seem to figure out why the y value is anything but zero when I move left or right on flat ground.
@diamondfiremc2514
@diamondfiremc2514 Жыл бұрын
make sure your platform that you made is flat, if it is 1 pixel higher in one spot it could do that, if not then I have no idea lol
@AreHorsesReal
@AreHorsesReal Жыл бұрын
@@diamondfiremc2514 I got it figured out, it was an issue with the composite collider on a tilemap causing it to be set extremely close to zero like 4.82629e-8 or something. Thanks for the fast response tho
@diamondfiremc2514
@diamondfiremc2514 Жыл бұрын
@@AreHorsesReal never considered that but now that you say it, that explains everything lol, no problem as well, just happened to be in the right place at the right time
@everything-editz785
@everything-editz785 Жыл бұрын
Best unity tutorial i havrme ever seen 10/10
@deanv1265
@deanv1265 2 жыл бұрын
Best youtube channel in town
@Squidgreen
@Squidgreen 2 ай бұрын
Fantastic tutorial!
@BigCMakesVids2.0
@BigCMakesVids2.0 15 күн бұрын
I copied your actions and I just fell through the floor.
@BigCMakesVids2.0
@BigCMakesVids2.0 15 күн бұрын
Fixed but it's impossible to jump
@bendux
@bendux 10 күн бұрын
You probably skipped one or two important steps in the tutorial.
@BigCMakesVids2.0
@BigCMakesVids2.0 10 күн бұрын
@@bendux I used your code from GitHub, I dunno what's wrong with it.
@bendux
@bendux 3 күн бұрын
@@BigCMakesVids2.0 If you follow the video step by step, you should end up with a moving and jumping player.
@Imjustthatguyyyy
@Imjustthatguyyyy 7 ай бұрын
When i do the flip part it is wrong for some reson
@bendux
@bendux 5 ай бұрын
What do you mean?
@Imjustthatguyyyy
@Imjustthatguyyyy 5 ай бұрын
Oh i was a very new coder and i just Think that i wrote it wrong😅 I have found another tutorial and it works now ( and i love your tutorials❤)
@bendux
@bendux 5 ай бұрын
@@Imjustthatguyyyy I'm glad you were able to fix it. Thank you!
@BarrowWight
@BarrowWight 2 жыл бұрын
Which button input is used to jump? I know this is a dumb question but I followed the code exactly and tried all buttons on my keyboard but not triggered any sort of jumping action.
@bendux
@bendux 2 жыл бұрын
Did you position the ground check at your player's feet?
@BarrowWight
@BarrowWight 2 жыл бұрын
Hadn't checked that. thanks for the advice :)
How To Dash In Unity
3:53
bendux
Рет қаралды 143 М.
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 733 М.
CAN YOU DO THIS ?
00:23
STORROR
Рет қаралды 45 МЛН
Я сделала самое маленькое в мире мороженое!
00:43
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 107 МЛН
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,2 МЛН
Code Class - 2D Player Movement in Unity
29:02
AdamCYounis
Рет қаралды 50 М.
How To Wall Slide & Wall Jump In Unity
6:38
bendux
Рет қаралды 75 М.
The Most Impressive Scratch Projects
11:00
DenshiVideo
Рет қаралды 5 МЛН
Improve your Platformer’s Jump (and Wall Jump) | Unity
8:12
Dawnosaur
Рет қаралды 122 М.
TOP DOWN MOVEMENT in Unity!
22:30
Brackeys
Рет қаралды 1,2 МЛН
No One Hires Jr Devs So I Made A Game
39:31
ThePrimeTime
Рет қаралды 266 М.
How to Ruin Geometry Dash
17:52
GD Colon
Рет қаралды 310 М.
The Future of Game Development
8:58
Brackeys
Рет қаралды 1,3 МЛН
CAN YOU DO THIS ?
00:23
STORROR
Рет қаралды 45 МЛН