@ErraticPulseГод назад +101
Fun Fact, if u look at some of the areas on the script window you will notice that the language is in german
@dumsparaside4 месяца назад
yes I found out
@guyinaraincoat4292Год назад +31
This tutorial was very helpful by showing the whole process of making the script that made the character move, Thank you!
@fluffystuffГод назад +58
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Год назад +5
Yeah what in the world is going on here ._.
@SkitozzzГод назад +1
@@Externium :)
@deilruchiГод назад +71
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Год назад +7
Been working on this issue for literally weeks, bless you wise internet stranger!
@deilruchiГод назад +1
@@joshpreston4957 Glad it helped you, because it took me a while as well.
@mariazia221Год назад +1
where
@deilruchiГод назад
@@mariazia221 ruclips.net/video/K1xZ-rycYY8/видео.html
@Garfield_MinecraftГод назад
OMG thank you god it's been 3 hours just sitting here what went wrong
@enderpigerdragon358910 месяцев назад +8
Thanks for the awesome 2D movement in Unity tutorial! Super helpful! 👍
@polyhedrainteractive96638 месяцев назад +1
This is incredible, I coded for a while but couldn't get past the basics will watch more
@monkeypwners10 месяцев назад +9
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!
@historyjuniorГод назад +4
This is an amazing tutorial! Thank you so much, I really loved this!
@nagisa1578Год назад +2
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.
@FireGloves9 месяцев назад +37
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);
}@Bigblackhawk1239 месяцев назад +4
It doesn’t work even if I press space though 🫤
@dalegacy28778 месяцев назад
@@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. :)
@zanahtile62768 месяцев назад +3
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
@swiniapierdek7 месяцев назад
omg thank you I haven't knew that.
@TheGreyCat10266 месяцев назад
that was the problem, thanks!@@zanahtile6276
@yugnatata2 месяца назад +1
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!
@The_GronneГод назад +123
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Год назад +1
Mee too, i give it 100/100!
@mitchelllockyer7541Год назад +12
bippity boopity your code is now my property
@yumura13710 месяцев назад
very simple yet satisfying and fun movement, straight to the point video, simply one of best on youtbe
@francheeze11 месяцев назад
Simple, quick & elegant. Nice!
@lemason5981Год назад +5
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 Год назад +2
Haha, I'm definitely not a wizard.
@NewSunnahAcquiredМесяц назад
@@bendux thats exactly what a wizard would say
@Skylar.H93Год назад +25
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 Год назад +5
I'm glad I could help. Good luck!
@LucaThePupineer6 месяцев назад
HOW THIS FEELS IMPOSSIBLE
@lennystudios3.148 месяцев назад +1
Love it, I personally like adding a Lerp function for some smoother acceleration and floatier physics, but that’s just my prefrance
@JohnKirk-eb6nkГод назад
I have watched tons of tutorials, best one yet
@LilCouveГод назад +3
Thank you, this was my first time using C# and this really helped me!
@JustSplatoonGameplayГод назад +12
Hey! Just wondering, if we want to animate, what boolean or Float should i use for the transition?
@foo32682 года назад +1
underrated channel, hopefully unity notices you someday
@DevNoob2 года назад
Always good videos! 1k subs let's go!
@W5AKC2 года назад +3
Very nice and simple.
@slayerghande79692 года назад +5
Yo, great work here 👏.
Don't ever stop and you will be the new brackeys@Tapov_Год назад +2
Thanks for the tutorial! I'm a beginner and this helps alot!
@BILGI_PASAГод назад +1
Thank you bendux. The video helped me so much.
@matsu47212 года назад +16
Thanks for this awesome smooth moving video, but can you do 2d enemy ui or shooting?
@bendux 2 года назад +3
I've added it to my list. Thank you for the suggestion!
@ZephyrAnimationss2 года назад +2
@@bendux YEsssssss exactly what i wanted thanks(i want to make a shooter game cuz im new)
@amburdo6206Год назад +5
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 Год назад +2
Edit > Project Settings > Input Manager
@amburdo6206Год назад
@@bendux Thanks a lot!
@lilili7658 месяцев назад +1
@@benduxwhat do i do in inputmanager
@Jamal38852Год назад +1
You literally saved me by making this video, earned a sub
@KenB120611 месяцев назад
thank you so much, sir bendux! it help quite significantly
@frogwavГод назад +4
You explained this well. also it works. thanks!
@its_a_gamer5279Год назад +9
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 Год назад
Thank you for sharing!
@its_a_gamer5279Год назад
@@bendux np!
@wogs2kГод назад
I did this and it still doesn't work
@bendux Год назад
@@wogs2k Join our Discord server, and let's solve your problem together!
@sirnoodle2004Год назад
@@wogs2k Also make sure that on both the BoxCollider2D of the player and the platforms, the box "Is Trigger" is not ticked
@markotafa6 месяцев назад +1
I like people that actually put code in the despcription :)
@artofariiГод назад
Nicely Explained. Thank you so much!
@cheezeburger7716Год назад +7
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 Год назад
Would you like to show me your code on Discord?
@cheezeburger7716Год назад
@@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 Год назад
@@cheezeburger7716 I'm glad you were able to fix it.
@ab7299Год назад +1
@@cheezeburger7716 can you tell me how you fixed it? i want to fix it too
@aniime4006Год назад
@@cheezeburger7716 can you tell me how you fixed it? i want to fix it too
@Arrzee.Год назад +26
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;
}
}
}@wizard731711 месяцев назад +1
yo, my serialized fields arent showing up in my unity project and i was wondering if you could help
@noona770110 месяцев назад
@@wizard7317 did u save the script in vs before going back to unity?
@furyz03399 месяцев назад +1
this script gives me no movements :c i turn left and right but cannot move
@noona77019 месяцев назад +3
@@furyz0339 you have to change the speed in vscode to 8 (in the comment it is set to 0)
@furyz03399 месяцев назад
thank youuu @@noona7701
@1ts_Leen09 дней назад
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.
@potato_legend127Год назад +1
Thank you for this video. It helped me a lot!!!
@krzaczastyyt65472 года назад +3
Your tutorials are the best i gona make a game with those
@Nintendostar02Год назад +3
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 Год назад +2
I've added it to my list. Thank you for the suggestion!
@r.ssolanki4841Год назад
Very well explained, thanks a lot!!
@gameormusic2360Год назад
bro is definitely not a beginner, Very helpful video and thank you
@feddyfadbear79852 года назад +3
hey, great video, everything is working fine but im jumping WAY too high, how can i decrease the jump power?
@bendux 2 года назад
Decrease the jumping power at the top of the script.
@BHArv3yГод назад +3
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!
@alexwellman6605Год назад +14
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 Год назад +7
Add a Composite Collider 2D component to your tilemap.
@alexwellman6605Год назад +5
@@bendux thank you so much
@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Год назад
Brackys tutorial is where all the souls go😂😂
@xsool-yl7usГод назад
this help out a ton thanks man
@EmirDuman15 месяцев назад +4
i can't jump
@finngrainger3495 месяцев назад
neither, left and right works just no jump
@wayvoedorado714 месяца назад
have any of you found a solution yet? It looks like it's a common problem.
@finngrainger3494 месяца назад
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
@wayvoedorado714 месяца назад
@@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 4 месяца назад +1
You probably skipped one or two important steps in the tutorial.
@RichardBarnes02 года назад +12
The old input system is not worth using anymore.
@lilDrizzyyyГод назад
Yes it is stfu
@tunahanyilmazdev2 года назад +1
Great as always!
@eshaanb2362Месяц назад
Thank you so much, this tutorial was very helpful!
@VonMoosHarrisonГод назад +7
Literaly the most difficult to understand tutorial
@vrsuhfx2 года назад +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 2 года назад +2
The answer to your question goes beyond the scope of a RUclips comment, but I'd still like to help you. Join our Discord server, and let's solve your problem together!
@travisc8406Год назад
can we just appreciate that he is still responding to comments! you're awesome!
@dmitriyleonov69777 месяцев назад +2
Отлично. Я делал подобный урок от другого автора. Персонаж дёргался. А тут всё движется плавно и код выполнен здорово компактно. Настройки физического тела показал как настроить . Спасибо за урок
@everything-editz785Год назад
Best unity tutorial i havrme ever seen 10/10
@kruziksuleyk95363 дня назад
This helped heaps thank you so much
@carlosalbertobatistacruz7 месяцев назад
Nice tutorial, the SpriteRenderer Component can also be used, just get the flipX (bool) attribute, instead of using localScale -1.
@woslake7576Год назад
Thanks !! I love your video.
@eylul2140Год назад
Your tutorial is great ♥
@c0rse198Год назад +1
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Год назад +1
HELP
PLEASE
@Hyper_alexaГод назад
that is helping me a lot man tnx
@RelaxReisenГод назад
Danke, hat problemlos geklappt!
@user-ve5rr9bp3nДень назад
thank you so much ,without you i would still be stuck in how to move it .
you've got a sub@Hollowdude15Год назад
Unity is so cool and nice video man :]
@beepboop2851Год назад +1
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 Год назад +1
The source code on GitHub is the same as in the video.
@antoniosalazar9505Год назад
Thanks, I was just looking for this.
@felixkostur72311 месяцев назад
thx this was really useful and it works for me
@Bashi_boi4 месяца назад
Really helpful tutorial thanks :)
@jetsi604Год назад +1
THANK YOU! I was strugling with my code for couple hours :D
@Nexorix_Год назад
Am a noob in c sharp and it worked intantly Thanks man !
@gencerlive11 месяцев назад +1
Thanks bro helps alot
@kidthelett3 месяца назад
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
@chrono950311 месяцев назад
Its better to use a trigger colider instead of an empty object to check for grounded so you can change the width
@bendux 11 месяцев назад
You can adjust the radius of the ground check.
@jonasgustafsson103210 месяцев назад +1
Very Good tutorial
❤@funforgingstudio46902 года назад
Thank you very much!
@excaliber_bruhГод назад +1
thank you so much man also my code was giving me a million errors so i just downloaded code and now it works perfectly 😎
@bendux Год назад
I'm glad you were able to fix it.
@renegade1807Год назад
Thanks so much. Had a lot of trouble with this issue. Sub'd
@Nullphode9 дней назад
this'll come in handy
@puyanph6114Год назад
Nice job bro 😀❤️
@deanv12652 года назад
Best youtube channel in town
@dkoorseГод назад
thanku! its a good movement script
@AplekerГод назад +1
Hippity Hoppity Your Code Is Now My Property - "Apleker"
@hotrod7085Год назад
I love love love your video it helped me allot, but I have one question how do you change spacebar to up arrow for jump?
@bendux Год назад
Edit > Project Settings > Input Manager
@hotrod7085Год назад
@@bendux thank you
@IvanLiraГод назад
THANK YOU SO MUCH !
@mrcodingfrog89372 года назад
Thank you so much! :DDDD
@RedLeicesterCheeseГод назад
Very nice tutorial
@user-tx9kr8mz1vГод назад
Thanks. Realy helped
@arda7z6572 года назад
Understandable and easy.
@Jamsey200Год назад +1
Thanks for teaching us in dark mode
@KrixerVR3 месяца назад
This helped me alot and I even somehow got my player to infinite jump like flappy bird. Definitally a win
@bendux 3 месяца назад
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.
@KrixerVR3 месяца назад
@@bendux Thx man, oh and btw I subbed to you for your awesome Unity tips!!
@bendux 3 месяца назад
@@KrixerVR I appreciate it. Thank you!
@stephenthang7607Год назад +1
I really appreciate to you that created this video cause it's helpful for beginners like me
@colinobrien1278Год назад +1
Love this Tutorial! but is there a way to change the keys that control movement? I want to change the space button to the W key to jump.
@bendux Год назад
Edit > Project Settings > Input Manager
@colinobrien1278Год назад
@@bendux Thanks you so much!
@zerschta4022Год назад
thanks for the tutorial
@emilian_spielt300Год назад
Thanks man! i had some struggle with the code but after i "Rebuild" it, it worked really nice for me! thanks for you video
@hashim2.1Год назад
thank you alot you helped me
@Arcann_bhp11 месяцев назад
if you get ur player to an edge of a platform it won't be able to jump bc the ground check under the player is in the middle and doesn't cover the entire size
@bendux 11 месяцев назад
You can adjust the radius of the ground check.
@fishrimГод назад
this was good thanks
@3li-37810 месяцев назад
Thx bro you areamazing thx you very much!
2D Player Movement In Unity (2024)
References
- https://magesinstituteofexcellence.blogspot.com/2024/06/10-common-unity-mistakes.html
- https://ruclips.net/video/K1xZ-rycYY8/2d-player-movement-in-unity.html
Top Articles
The 21 Best Restaurants On The Lower East Side - New York - The Infatuation
SIXTY LES Review: What To REALLY Expect If You Stay
Fernald Gun And Knife Show
Sprinter Tyrone's Unblocked Games
The Atlanta Constitution from Atlanta, Georgia
Tesla Supercharger La Crosse Photos
Frank Lloyd Wright, born 150 years ago, still fascinates
Triumph Speed Twin 2025 e Speed Twin RS, nelle concessionarie da gennaio 2025 - News - Moto.it
Brgeneral Patient Portal
Otis Department Of Corrections
Mcoc Immunity Chart July 2022
Craigslist In Fredericksburg
Tanger Outlets Sevierville Directory Map
What Is Njvpdi
Citymd West 146Th Urgent Care - Nyc Photos
DoorDash, Inc. (DASH) Stock Price, Quote & News - Stock Analysis
Illinois VIN Check and Lookup
Osborn-Checkliste: Ideen finden mit System
2020 Military Pay Charts – Officer & Enlisted Pay Scales (3.1% Raise)
Jalapeno Grill Ponca City Menu
How to Watch the Fifty Shades Trilogy and Rom-Coms
Long Island Jobs Craigslist
Accident On 215
Kashchey Vodka
Lola Bunny R34 Gif
Laveen Modern Dentistry And Orthodontics Laveen Village Az
Craigslist Battle Ground Washington
Strange World Showtimes Near Savoy 16
Hdmovie2 Sbs
Craigslist Pasco Kennewick Richland Washington
My Dog Ate A 5Mg Flexeril
Aid Office On 59Th Ashland
Rogold Extension
140000 Kilometers To Miles
Los Amigos Taquería Kalona Menu
Newcardapply Com 21961
Top-ranked Wisconsin beats Marquette in front of record volleyball crowd at Fiserv Forum. What we learned.
Watchseries To New Domain
Empire Visionworks The Crossings Clifton Park Photos
craigslist | michigan
Walmart Pharmacy Hours: What Time Does The Pharmacy Open and Close?
Guy Ritchie's The Covenant Showtimes Near Grand Theatres - Bismarck
Doublelist Paducah Ky
Dagelijkse hooikoortsradar: deze pollen zitten nu in de lucht
Rocket League Tracker: A useful tool for every player
Espn Top 300 Non Ppr
Zits Comic Arcamax
1Tamilmv.kids
Msatlantathickdream
Urban Airship Acquires Accengage, Extending Its Worldwide Leadership With Unmatched Presence Across Europe
Bomgas Cams
Loss Payee And Lienholder Addresses And Contact Information Updated Daily Free List Bank Of America
Latest Posts
Sams Lewisville Gas Price
15 Flavorful Lower East Side Restaurants in New York City (Everyone Must Try)
Article information
Author: Jamar Nader
Last Updated:
Views: 5974
Rating: 4.4 / 5 (55 voted)
Reviews: 94% of readers found this page helpful
Author information
Name: Jamar Nader
Birthday: 1995-02-28
Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804
Phone: +9958384818317
Job: IT Representative
Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging
Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.