Тёмный

Super Mario - Running Tutorial in Unity 

Press Start
Подписаться 24 тыс.
Просмотров 48 тыс.
50% 1

In this video to cover running in a 2D environment for Platformer games.
SUBSCRIBE: bit.ly/2Js78lE
============
SUPPORT: / pressstartclub
PART 1 on Character Animation:
• 2D Character Animation...
In this video, we cover:
0:40 - Adding a RigidBody2D and C# Script
1:24 - Defining Controller Input in C#
2:40 - Moving our Character with RigidBody2D.AddForce
3:35 - Adding Animation States to our Character
4:00 - Setting Up Animator Parameters in C#
5:20 - Flipping our Sprite in the Direction we are running
6:50 - Adding EdgeCollider2D
7:50 - Limiting Velocity with Max Speed
9:13 - Using Linear Drag to Stop our Character from running
10:30 - Changing Directions
11:11 - Final Product
COPY & PASTE CODE FROM THIS TUTORIAL:
pressstart.vip/tutorials/2019...
MORE TUTORIALS:
pressstart.vip/unity-tutorials

Опубликовано:

 

30 сен 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 88   
@nezbitnezbit5397
@nezbitnezbit5397 4 года назад
You are definitely one of the most underated unity youtubers
@pressstart6864
@pressstart6864 4 года назад
Thanks man!
@fantastico69
@fantastico69 3 года назад
​@@pressstart6864 Return with the videos, pls Your videos help a lot, because you explain the logic, no just the code itself.
@DemonkaiMugen
@DemonkaiMugen 3 года назад
yeah i co sign that majorly
@SeppvonderWeide
@SeppvonderWeide 4 года назад
This is just perfect man! You are one of the few unity youtubers who don't just copy stuff and have no clue what they are talkin about! U implemented everything in an unique way with perfect explanation! I've watched a lot of these tutorials lately and this is the best.
@widecarrot
@widecarrot 4 года назад
These series are so good! Quality is clearly a top priority in this channel
@pressstart6864
@pressstart6864 4 года назад
I'm glad you're enjoying the series. And yes quality is most important to me!
@orkbadger
@orkbadger 4 года назад
Dude, whoever you are, you are a fucking blessing let me tell you. Was gonna check your jumping code only, and thought to myself "I already know the movement part", but after checking this, the stuff you write seems super simple and understandable, yet complex on a different level in terms of game mechanics. You really taught me a lot in a subject that I thought I knew well. Hope you get the subs number you deserve soon.
@DemonkaiMugen
@DemonkaiMugen 3 года назад
MAN you are the greatest teacher for this smh i went through at least FIVE youtubers trying to explain animation transition and they were horrible at it i see. i kept being left without a clear great answer for a week! Anyway this is my first month starting Unity and trying my hand at a 2D platformer and transitioning and getting my sprite to turn around was the hardest damn thing to pull off. i have to save and download your video.. its the best. thanks for breaking this down. i finally got it right
@ashfid8987
@ashfid8987 4 года назад
Really enjoy these videos. I make systems of my game most of the time. I am really bad at how to make things look good, you helped me a lot of times to recreate something from older games and I seriously want to thank you for it. I agree, you are definitely underrated. Great presentation, consistent flow of explanation and short videos on single topic.
@pressstart6864
@pressstart6864 4 года назад
I really appreciate the kind words and I'm glad I could help you in your game dev journey.
@ItamiPlaysGuitar
@ItamiPlaysGuitar 3 года назад
Anybody who wants to create a platformer needs to watch this. Thank you so much
@tomasagustin3382
@tomasagustin3382 4 года назад
Best of all tutorial ive seen, pls countinue doing videos! hug from Argentina!
@gomango99
@gomango99 2 года назад
I love your controller script so much! I altered it to work with the new input system and it worked perfectly
@burnobad
@burnobad 3 года назад
Thit is amazing tutorial, your channel is what i was searcing for ages
@Anuiran
@Anuiran 4 года назад
I can see this channel blowing up in a month or two, you do great work.
@pressstart6864
@pressstart6864 4 года назад
Let’s hope so mate
@abhilashpawar1875
@abhilashpawar1875 4 года назад
Whoa man! Great tutorial! I got smooth movement because of you!
@LennoxParsec
@LennoxParsec 3 года назад
This is the only video that explains how to move an object in a constant velocity using .AddForce instead of .velocity Thank you so much.
@PeopleLeapOn
@PeopleLeapOn 4 года назад
Great video man, clear and not too long, keep on this path! i'm waiting the jumping tutorial!
@pressstart6864
@pressstart6864 4 года назад
Thanks for the feedback. Working on the jumping video today, hoping to have it done for October 15th, release.
@eliplay123
@eliplay123 2 года назад
If someone's still watching this, the code has an error at this line of code: "Mathf.Abs(direction.x) < 0.4f" The reason for this is that we use "GetAxisRaw()" for getting Input parameters and that function returns either -1, 0 or 1 so it will never be ranging between those values. To fix this, you can use "(Mathf.Abs(direction.x) > 0f && changingDirections == true)" instead. Hope it helps!.
@mounik009
@mounik009 Год назад
Thank you, I was facing the same issue.
@davegamedevelopment
@davegamedevelopment 4 года назад
Nice, thanks for your awesome tutorial! Very helpful :D
@subtome5848
@subtome5848 4 года назад
Yes they're nice^^
@uba754
@uba754 4 года назад
Phenomenal video! I was just about to ask a question and then I realized my own error haha.
@JoseCruz-qs1pw
@JoseCruz-qs1pw 3 года назад
What amazing tutorial! Keep this videos quality :)
@karacter3369
@karacter3369 10 месяцев назад
this is soooooo good and simple!
@luedga9963
@luedga9963 3 года назад
really great video. helped a ton
@swarth8632
@swarth8632 3 года назад
Really helpful tutorial! Subbed!!!
4 года назад
Very nice stuff! Keep up the good work
@pressstart6864
@pressstart6864 4 года назад
thank you!
@ITeachChemistry
@ITeachChemistry 4 года назад
Your work is awesome man. Keep going!!!
@pressstart6864
@pressstart6864 4 года назад
Keep watching!!! You’re awesome!
@rezmon5311
@rezmon5311 4 года назад
Great overall videos! Subbed and notification bell ringed! Looking forward for more content :)
@pressstart6864
@pressstart6864 4 года назад
Look at this dood. Thanks!
@atifahmad6457
@atifahmad6457 3 года назад
Awesome trick with that rotate 180
@bigjamar
@bigjamar 4 года назад
Excelente..!!
@Yamam100
@Yamam100 3 года назад
amazing
@thangnobita1739
@thangnobita1739 2 года назад
thank you so much
@paulrumyancev
@paulrumyancev 3 года назад
I think that "Mathf.Abs(direction.x) < 0.4f" check is a little mistake. The author uses GetAxisRaw() for getting Input parameters and the function returns either -1, 0 or 1 and will never be ranging between those values.
@maistrogaming7911
@maistrogaming7911 4 года назад
keep making video one day you will get 1 m subs...u r one of the best..like to who think i am right
@marianogonzalez4663
@marianogonzalez4663 4 года назад
Hi, thank you very much for the free learning resources, it's really helpful when starting out. I wanted to ask you, why you use an edge collider instead of a box collider? To me they seem to be pretty much the same thing.
@GwynPerry
@GwynPerry 4 года назад
You can resolve the tile collision issue by using a composite collider. Just remember to set the tilemap's rigid body to static.
@pressstart6864
@pressstart6864 4 года назад
Hmmm
@benjamingerd4703
@benjamingerd4703 4 года назад
Agreed. When working with Tilemap, using a CompositeCollider in addition will solve issues that arise from your character colliding with the edge where two tiles meet.
@andrew_ceco
@andrew_ceco 3 года назад
I haven't learned how to use composite colliders yet, and I can't say I know what's better in terms of runtime or efficiency and such, but I've found that adding a physics material to the edge collider has effectively solved this problem for me too :)
@SageNode
@SageNode 4 года назад
why in this video you took out the vertical parameter and the fall animation?
@charliecooper3030
@charliecooper3030 4 года назад
Why did you put the CharacterController script on the top level player game object in the first video but in this video it's not there, just Rigidbody 2D and the Player script?
@praetosstuff8230
@praetosstuff8230 4 года назад
I need help. When I quickly double tap the button associated with the direction I am facing, I can't move in whatever direction I was facing. Any idea on how to fix this?
@JKMT
@JKMT 3 года назад
underrated, although seems like a lot of code for that smoothness
@canuniverse3367
@canuniverse3367 3 года назад
ahh hey, I have an issue that my players edge collider stucks to the edges of my tile map collider if I use a composite collider for tile map then the edge collider doesn't work is there any way to solve this
@Charlie59876
@Charlie59876 2 года назад
is there a way to change how fast the player accelerates?
@kaiser9321
@kaiser9321 4 года назад
If you click on your tiles and your collider is defined by a bunch of boxes, you should add a composite collider as well which will also include a Rigidbody 2D, just set that to Static and it shouldn’t be doing what’s happening at 7:10
@benjamingerd4703
@benjamingerd4703 4 года назад
Agreed. When working with Tilemap, using a CompositeCollider in addition will solve issues that arise from your character colliding with the edge where two tiles meet.
@avi6961
@avi6961 3 года назад
Can I use the same code for the Mario game created in 3D?
@link64_blend95
@link64_blend95 3 года назад
in my case the rigidbody doesn't change the linear drag. does anyone know how i can fix this?
@MikeKing710
@MikeKing710 4 года назад
Well, is it not good to use for 3d player object?
@DrLengen
@DrLengen 2 года назад
Now how do I do this in 4 directions? I'm having trouble with the New Input System.
@SageNode
@SageNode 4 года назад
I had to get rid of this line of code cause it kept giving me an error saying that string doesnt exist when it clearly did exist. and it seems this line of code didnt do anything anyways animator.SetFloat("horizontal", Mathf.Abs(rb.velocity.x));
@s41to
@s41to 4 года назад
i have a problem when my character changes directions, the idle animation is called for a sprite when is already moving in the other direction.
@Masterxroshi
@Masterxroshi 4 года назад
probably abit late but its got to do with how you setup the animations. watch some videos on transitions and you will understand. to give you the gist of it, disabling exit time and editing the transition time to lower values makes the transitioning between animations more fluid. i recommend watching blackthornprods video on animation to get all the details but I'm sure theres many other RU-vidrs who can give you the same info.
@djninjitsuchannel7857
@djninjitsuchannel7857 3 года назад
I love you
@SantiagoMaki
@SantiagoMaki 2 года назад
1000th like
@LegendJ0e4
@LegendJ0e4 3 года назад
when my character goes to run left, he doesn't turn to face left why
@SageNode
@SageNode 4 года назад
When making the transitions between animation states at the end of the last video, you skip showing the transitions for the falling animations, you only show fall -> idle im having trouble getting it to work
@hunkydoodle2374
@hunkydoodle2374 4 года назад
I'm having trouble with getting this to handle slopes, my characters little legs are just too weak!
@voidling2632
@voidling2632 4 года назад
don't use rigidbody2D.addforce if you use slopes... either write your own physics... or just use rigidbody2D.velocity = new Vector2(moveSpeed*direction.x,rigidbody2D.velocity.y)
@derekw8039
@derekw8039 3 года назад
How do you do this in 3D?
@SageNode
@SageNode 4 года назад
Im getting an error and im not able to move. the error is: ArgumentException: Input Axis Verticle is not setup. To change the input settings use: Edit -> Settings -> Input PlayerCharacter.Update () (at Assets/Scripts/PlayerCharacter.cs:44) cs:44: direction = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Verticle")); Im stumped, becuase ive checked my input settings over and over in unity and everything is set
@SageNode
@SageNode 4 года назад
ah.... I spelt Vertical wrong lol
@seighart90
@seighart90 3 года назад
Why don't you use velocity instead of addforce?
@noahlevine7894
@noahlevine7894 4 года назад
why did you use rb.Addforce instead of rb.MoveCharacter?
@efn5520
@efn5520 4 года назад
Because he wanted acceleration
@mueqatrae1464
@mueqatrae1464 4 года назад
if you don't use AddForce for the player movement you can avoid all those headaches
@pressstart6864
@pressstart6864 4 года назад
Sure, if you don’t want to use any physics or collision elements in your game, but most platformers do. I try to avoid using addForce as much as possible but if you want a true to feel character controller, it’s sort of unavoidable.
@benjamingerd4703
@benjamingerd4703 4 года назад
@ MueqaTrae It appears as though he is using `rb.AddForce` here to avoid having to implement his own movement acceleration. Since `rb.AddForce` adds to the character's existing velocity every frame, it effectively gives him the acceleration he desires for a Mario like game feel. However, I also noticed that he is mixing the use of `rb.AddForce` and `rb.velocity` in his code.
@benjamingerd4703
@benjamingerd4703 4 года назад
@PressStart Is there a specific reason you decided against defining an acceleration constant and integrating the movement yourself? (re "if you want a true to feel character controller, [using AddForce is] sort of unavoidable") ``` // Acceleration per physics step [SerializeField] private float moveAcceleration; private void moveCharacter() { rb.velocity = new Vector2( rb.velocity.x + ( direction * moveAcceleration * maxSpeed * Time.fixedDeltaTime ), rb.velocity.y ); // (...) } ```
@captainhoneybee8435
@captainhoneybee8435 4 года назад
If there is one thing I'll take away from this is to use the "animator windor"
@mexagrontoo
@mexagrontoo Год назад
please come back!
@sirgaming-gaminglikeasir9360
@sirgaming-gaminglikeasir9360 3 года назад
What about transform.position lol
@CYB3Rsynth
@CYB3Rsynth 3 года назад
great video...but damn if your coding style doesnt frustrate the hell out of me lol. most unpretty... like bruh Capitalize your functions
@SageNode
@SageNode 4 года назад
well, whole day wasted. start from scratch tomorrow
@IDontReadReplies42069
@IDontReadReplies42069 4 года назад
why do you have to start from scratch lmao. Imagine starting over every time something doesn't work out
Далее
How to Make a Good 2D Camera
11:38
Просмотров 393 тыс.
I Made Super Mario 64 In 64 Hours! - Unity Devlog
10:20
Super Mario Land Color - Full Game 100% (All Levels)
21:21
A Perfect Jump in Unity - A Complete Guide
17:05
Просмотров 75 тыс.
Can I Remake Super Mario World in Godot? (Part 1)
18:44
How to ACTUALLY get into Gamedev
14:01
Просмотров 706 тыс.
Is Super Mario Bros Wonder COMING To Mario Maker 3?!
9:18
Unity Movement [RigidBody vs Translate]
9:00
Просмотров 283 тыс.
AI Learns to Speedrun Mario
8:07
Просмотров 734 тыс.