Visit the GitHub page for the most up to date source code: github.com/zigurous/unity-super-mario-tutorial View the FAQ for answers to common questions: github.com/zigurous/unity-super-mario-tutorial/wiki
Oh I wish I read this first, was looking for the reference for 1-1, I ended up putting an overlay of 1-1 scaled best I can and basically lined it up that way 😆🤪
Fantastic tutorials, for me learning practical stuff is much more useful than dry theory with documentation, and the way you break the whole game into small digestible pieces, and how eloquently you explain each part and connect it all together is just fascinating. Huge props for your organization and explanation skills, they're exceptional
@Zigurous, This series of videos is amazing. There is nothing better than re-creating classic games in Unity. I have learned so much already. It's straight to the point and explained very well. Thank you for putting in the time and effort to create such exceptional content. You sir, are a gentlemen and a scholar! 👍
Hi Zigorous and thanks for those videos. I honestly think they are the best Unity resource on UA-cam right now. If I may make a suggestion: write much less code before showing the result. Eg: you wrote the jump functionality all at once. Since it’s a complicated peace, it would work better if you showed when it DIDNT work ok. “Ok, see, Mario jumps, but you can keep jumping in middle air. Add a check to see if it’s grounded” ”Now he jumps, but it doesn’t fall down, see? Let’s code that.” “Now, as you can see, it falls down, but the physics are a bit off. Let’s add a multiplier”. And so on. This would greatly help to understand WHY the things are done the way they are done! Thank you for your time :)
Whoa, amazing! This teaches so much about programming, C# and Unity. The explanations are clear, voice is good and calm. Pacing is excellent. Top quality video!
Zigorous, your content is high quality teaching and all, but I wish I could show you how my smile faded when I realised the next tutorial was 2 HOURS💀💀
How would we prevent the wall velocity glitch for the camera barrier? Since we are doing this in the movement without a collider we can not use the raycast extension for the rigidbody. Edit: I found a solution! Replace the clamping code with these lines: Vector2 tempPos = position; position.x = Mathf.Clamp(position.x, leftEdge.x + 0.5f, rightEdge.x - 0.5f); if (position != tempPos) { velocity.x = 0f; }
EDIT: WATCHING MY CHARACTER MOVE FOR THE FIRST TIME WAS INCREDIBLE!!! THANK YOU!!! Watching Mario move left to right at18:30 for the first time was extremely exciting! You should have added some game noises to video here and there! This is wonderful! Thank you so much for doing these tutorials!
Next tutorial make on UI menu and how to do transition between those levels scene . And make level selection menus.. Some animations using DoTweeen package to animate the UI button..?
In general you are good bro, in fact, I have learn many things with your tutorials and tips, really cool. The problem is not what you show, is that some things doesn't work in my side xD but I'm already fixing it. Hope to see more videos of yours after finishing the series.
58:48 I would love to correct a small mistake here, which is that the dot product itself doesn't give those values (-1,0,1) but instead its the cosine in the dot product formula, let me explain further so we have two vector belonging to R^n ( to any dimension, in this case 2d (R^2) or 3d (R^3) ) called U and V U . V (U dot V)= ||U|| .||V|| .cos (U,V) ||U|| length of vector U ||V|| length of vector V (U,V) the angle between the vectors U and V so the operation U.V is going to give a scalar (normal number not a vector) that belongs to R But cos (U,V) would give a number between -1 and 1, which is used to tell the directions of the 2 vectors compared to each other the way u explained it 1:00:18 I did a little search about unity's dot operator, and it does give off a result of a normal algebra dot operation, unless the vectors are normalized, in that case, it would return the results u have mentioned
You set the x velocity to 0 when you are running but hit an obstacle such as a wall/pipe. However if you go back to the left and hit the edge of the screen but not an obstacle, the velocity doesn't get reset back to 0. Also, what about fast running like you are holding down the b button?
Please someone help me! After coding jumping and gravity my Mario just starts to fall way down for infinity like there’s no collide between ground and Mario what’s I did wrong and what can I do to fix it!
Hi, many thanks for your video. it is amazing for me. i have one question about movement in X. when i typed the code about jump, it is found the movement in X never working. it can be moved in X when jump is activated.
I'm not really sure how that line of code could cause your X movement to stop working unless you mistyped something elsewhere in the code. This one line of code is only affecting the Y velocity, so there's got to be another problem somewhere else.
Help me please. I did everything as in the video, but when the project starts, the camera does not see the character, the level itself is simply displayed, without the character.
If you're like me and you don't like the long time of Mario coming to a full stop, you could do this: public float friction = 2f; //whatever feels good to you velocity.x = Mathf.MoveTowards(velocity.x, inputAxis * moveSpeed, moveSpeed * friction * Time.deltaTime);
I've been following along but as soon as we got into the sprites and animation I've encountered a few errors. The first is that even though I've been doing everything with smaller Mario, my sprite now defaults to the Super Mario. But then with the slide sprite it seems to want to stick on slide after it plays and doesn't snap back the way it should. It also is quite delayed. Edit: Figured it out. I had misplaced a greater than sign and changed it up, so it was throwing me some crazy stuff. Also, for some reason I had turned back on my Super Mario which brought both of the Mario states up. Figured it out though!
This isn't really a problem, but my VS code doesn't display colors like yours for stuff like Mathf or whatever when the code is definitely correct, how do i change the settings inside VS code to match yours?
Hey, i'm new to all this and learning c# coding and using unity as i go. I have a problem though. The menu that is under scene with the 2d and light bulb is not there on mine. Is it an error, do i need to download something else?
Watching tutorials can help you learn new techniques that you can apply to your own games, but it still requires you to practice your skills. You'll become a better problem solver by making your own games and trying to work through the problems that come up. You'll get better at it the more you do it.
@@Zigurous Next tutorial make on UI menu and how to do transition between those levels scene . And make level selection menus.. Some animations using DoTweeen package to animate the UI button..? And making mobile responsive design game ....
Is anyone else's Mario running into an invisible wall at a certain coordinate? I have rewrote the whole program and still am having this issue. I'm a C# ASP dev and cannot seem to find where in the camera script this is happening. Any help would be appreciated!
hi thanks for the really well done video, I tried all the procedures but the player doesn't jump it just goes forward or backward, the only way to make this work was to activate the "is trigger" option but by doing so the character collapses into the empty downwards
At 1:36:50 he changes Sprite to AnimateSprite. When I do this, I have an error CS0246 "The type or namespace name 'AnimateSprite' could not be found (are you missing a using directive or an assembly reference?)". Does anyone know the solution to this?
If there is another person in the comments that also knows how to code, can somebody please tell me how to fix Mario's run animations? It keeps saying that something is wrong, and I double checked my work.
Another great tutorial. I’m curious why, since you’re applying movement manually rather than manipulating the rigidbody via apply force, why you didn’t just apply the movement to the transform?
Because the ridgidbody is the physics object that is used in the collision calculations. If you move the transform directly the collider might not move in the same frame with the transform (because physics updates have a different frame rate) and you can get weird behavior from that.
i don't know if you're still responding to the comments or if someone here can explain it to me but for the head collision i tried to make use of the static raycast function but with vector2.up and it didn't work.Anybody got a clue ? i want to essentially create a circle collider at the head of mario and check if his head bump into object,isnt that better than using the whole body collider ?
I had the same issue where my mario was falling down infinitely after pressing play. The problem was that my collider for the ground blocks was not placed correctly. Idk if this will help but I hope you found a solution otherwise.
My Mario's head is sticking to the blocks like a magnet, he can move and when moving out from under the block he falls to the ground. In the debugger I noticed it registers him as grounded when his head touches the underside of the block. Anyone know why?
check the radius and distance inside Raycast, you should first set the boxcollider size to 0.25, and then measure its way down to the ground block, see how much the Y value changes, which should be the value of the float distance i mentioned above. By doing so you limit the collider area of your mario to the bottom half of his body instead of from head to toe.
(*help) Done till 50:01 added everything side scrolling , player movement and extension now my character is not moving and there is no error, earlier the character would move left and right and camera as well (*help)
I had problems with the running animations, every time when i stopped running and started running again it seemed like my framerate doubled. I fixed this by changing the OnEnable function with the start function. Does anyone have a idea why this happened?
Visit the GitHub page for the most up to date source code: github.com/zigurous/unity-super-mario-tutorial
View the FAQ for answers to common questions: github.com/zigurous/unity-super-mario-tutorial/wiki
Oh I wish I read this first, was looking for the reference for 1-1, I ended up putting an overlay of 1-1 scaled best I can and basically lined it up that way 😆🤪
Fantastic tutorials, for me learning practical stuff is much more useful than dry theory with documentation, and the way you break the whole game into small digestible pieces, and how eloquently you explain each part and connect it all together is just fascinating. Huge props for your organization and explanation skills, they're exceptional
@Zigurous,
This series of videos is amazing. There is nothing better than re-creating classic games in Unity. I have learned so much already. It's straight to the point and explained very well. Thank you for putting in the time and effort to create such exceptional content. You sir, are a gentlemen and a scholar! 👍
This is way better than UNITYs own teaching/training videos. I understand how you explain things way better.
Hi Zigorous and thanks for those videos. I honestly think they are the best Unity resource on UA-cam right now. If I may make a suggestion: write much less code before showing the result. Eg: you wrote the jump functionality all at once. Since it’s a complicated peace, it would work better if you showed when it DIDNT work ok. “Ok, see, Mario jumps, but you can keep jumping in middle air. Add a check to see if it’s grounded” ”Now he jumps, but it doesn’t fall down, see? Let’s code that.” “Now, as you can see, it falls down, but the physics are a bit off. Let’s add a multiplier”. And so on.
This would greatly help to understand WHY the things are done the way they are done!
Thank you for your time :)
Whoa, amazing! This teaches so much about programming, C# and Unity. The explanations are clear, voice is good and calm. Pacing is excellent. Top quality video!
Great video, learned a lot. Just finished the video, no bugs, no problems, worked perfectly
Zigorous, your content is high quality teaching and all, but I wish I could show you how my smile faded when I realised the next tutorial was 2 HOURS💀💀
My Mario won't walk. All he does is stare at my soul.
have you found the bug, what you did wrong ?
Same with mine. Did you find a solution?
How would we prevent the wall velocity glitch for the camera barrier? Since we are doing this in the movement without a collider we can not use the raycast extension for the rigidbody.
Edit: I found a solution! Replace the clamping code with these lines:
Vector2 tempPos = position;
position.x = Mathf.Clamp(position.x, leftEdge.x + 0.5f, rightEdge.x - 0.5f);
if (position != tempPos) { velocity.x = 0f; }
Tbh I found an easier solution by making a wall as a child in camera. The wall has a box collidor and when the camera moves it moves with it.
this is a great tutorial i think u need to check the mario slide when he slide he turn his face to where he is going not forward
EDIT: WATCHING MY CHARACTER MOVE FOR THE FIRST TIME WAS INCREDIBLE!!! THANK YOU!!!
Watching Mario move left to right at18:30 for the first time was extremely exciting! You should have added some game noises to video here and there! This is wonderful! Thank you so much for doing these tutorials!
Next tutorial make on UI menu and how to do transition between those levels scene . And make level selection menus..
Some animations using DoTweeen package to animate the UI button..?
thanks for the nice video.
I think you should use the new input system in your projects,
In general you are good bro, in fact, I have learn many things with your tutorials and tips, really cool. The problem is not what you show, is that some things doesn't work in my side xD but I'm already fixing it. Hope to see more videos of yours after finishing the series.
Everything is working here
Same i dont know what i did wrong in gravity section but the jump isn’t accelerating or influenced by me holding down space
@@usercontent2112 yeah, I did it too nwn
@@zombiegamer1069 I have that code somewhere in my PC, let me finish with my work and I will see what could be happening
58:48 I would love to correct a small mistake here, which is that the dot product itself doesn't give those values (-1,0,1) but instead its the cosine in the dot product formula, let me explain further
so we have two vector belonging to R^n ( to any dimension, in this case 2d (R^2) or 3d (R^3) ) called U and V
U . V (U dot V)= ||U|| .||V|| .cos (U,V)
||U|| length of vector U
||V|| length of vector V
(U,V) the angle between the vectors U and V
so the operation U.V is going to give a scalar (normal number not a vector) that belongs to R
But cos (U,V) would give a number between -1 and 1, which is used to tell the directions of the 2 vectors compared to each other the way u explained it
1:00:18 I did a little search about unity's dot operator, and it does give off a result of a normal algebra dot operation, unless the vectors are normalized, in that case, it would return the results u have mentioned
Great tutorial Unity Sensei
You set the x velocity to 0 when you are running but hit an obstacle such as a wall/pipe. However if you go back to the left and hit the edge of the screen but not an obstacle, the velocity doesn't get reset back to 0.
Also, what about fast running like you are holding down the b button?
Hi Adam thanks a bunch this video's are really helpful
Hi, zigorus! been a fan since you started making tutorials on unity... I really am looking forward to completing this game after my last one! bye!
Nice vid man keep it up
Can you make 2d zombie survival game tutorial?
my camera is not moving and i did everything as the video said :( i even tried to change the "LateUpdate" to "Update" but didnt work
Sir can we use this asset for publishing on Google play ???
When is the next part out?? I can’t wait
ua-cam.com/video/BwilJ4ExljQ/v-deo.html
Thank you.
Please someone help me! After coding jumping and gravity my Mario just starts to fall way down for infinity like there’s no collide between ground and Mario what’s I did wrong and what can I do to fix it!
maybe when you applied "tiled drawing" to your groundblocks, you forgot to adjust its box collider to fit the whole sprite. check it
Hi, many thanks for your video. it is amazing for me. i have one question about movement in X. when i typed the code about jump, it is found the movement in X never working. it can be moved in X when jump is activated.
the code "velocity.y = Mathf.Max(velocity.y, 0.0f)" is typed, and the move in X is working. i cant understand what is problem. this is contol Y.
I'm not really sure how that line of code could cause your X movement to stop working unless you mistyped something elsewhere in the code. This one line of code is only affecting the Y velocity, so there's got to be another problem somewhere else.
@Adam Abbott did you find a fix for this mine has done the same !
34:03 OH NO
I'm not supposed to be here
for some reason my jumping doesn't work, i followed the code but idk what's wrong
ok jumping works now but when it hits an enemy it keeps the jumping animation on
I'm having the same jumping issue! How did you solve it ?
@@lovingCJ3 the jumping stopped working again 🥲
hello guys may I ask what algorithm for movement is been used in this Mario gameplay?
thank u
Help me please. I did everything as in the video, but when the project starts, the camera does not see the character, the level itself is simply displayed, without the character.
39:06 - I can't add the 3rd layer, it can't be changed in any way, what can I do with it?
If you're like me and you don't like the long time of Mario coming to a full stop, you could do this:
public float friction = 2f; //whatever feels good to you
velocity.x = Mathf.MoveTowards(velocity.x, inputAxis * moveSpeed, moveSpeed * friction * Time.deltaTime);
😍Nice Work!
sir can i use assest and publish game
I've been following along but as soon as we got into the sprites and animation I've encountered a few errors. The first is that even though I've been doing everything with smaller Mario, my sprite now defaults to the Super Mario. But then with the slide sprite it seems to want to stick on slide after it plays and doesn't snap back the way it should. It also is quite delayed.
Edit: Figured it out. I had misplaced a greater than sign and changed it up, so it was throwing me some crazy stuff. Also, for some reason I had turned back on my Super Mario which brought both of the Mario states up. Figured it out though!
Cool!
This isn't really a problem, but my VS code doesn't display colors like yours for stuff like Mathf or whatever when the code is definitely correct, how do i change the settings inside VS code to match yours?
I've followed all the directions and for some reason I can't get Mario to move? what do I Do?
I'm having this happen to my Mario too!
Love it ♡
Hey, i'm new to all this and learning c# coding and using unity as i go. I have a problem though.
The menu that is under scene with the 2d and light bulb is not there on mine. Is it an error, do i need to download something else?
Nintendo: NOOOOO WE CANT EARN MONEY NOW THE GAME IS BEING MADE IN UNITY
Is watching this type of unity tutorial is worth... Later can I make my own games and be a problem solver .....
Watching tutorials can help you learn new techniques that you can apply to your own games, but it still requires you to practice your skills. You'll become a better problem solver by making your own games and trying to work through the problems that come up. You'll get better at it the more you do it.
@@Zigurous Next tutorial make on UI menu and how to do transition between those levels scene . And make level selection menus..
Some animations using DoTweeen package to animate the UI button..?
And making mobile responsive design game ....
When my player gets larger, Mario, he can't jump. Do any of you know how to make the large Mario jump?
Is anyone else's Mario running into an invisible wall at a certain coordinate? I have rewrote the whole program and still am having this issue. I'm a C# ASP dev and cannot seem to find where in the camera script this is happening. Any help would be appreciated!
hi thanks for the really well done video, I tried all the procedures but the player doesn't jump it just goes forward or backward, the only way to make this work was to activate the "is trigger" option but by doing so the character collapses into the empty downwards
could you tell me how to solve it? I thank you in advance
Have you ever figured it out. Having the same problem
@@drellreacts6661 I solved it using the space, however check your jump key in the input manager
i dont understand any of this code like what is transform and why do you type this transform transform lol
Horizontal movement didnt work for me (I tried many times)
At 1:36:50 he changes Sprite to AnimateSprite. When I do this, I have an error CS0246 "The type or namespace name 'AnimateSprite' could not be found (are you missing a using directive or an assembly reference?)". Does anyone know the solution to this?
I figured it out. He uses AnimatedSprite, what works is using AnimationScript.
Hey I tried this tutorial and it was great but my Mario is not walking it starts rolling when I make it move so can any one help me for this
On the Rigidbody2D under constraints, did you freeze the rotation?
If there is another person in the comments that also knows how to code, can somebody please tell me how to fix Mario's run animations? It keeps saying that something is wrong, and I double checked my work.
Another great tutorial. I’m curious why, since you’re applying movement manually rather than manipulating the rigidbody via apply force, why you didn’t just apply the movement to the transform?
Because the ridgidbody is the physics object that is used in the collision calculations. If you move the transform directly the collider might not move in the same frame with the transform (because physics updates have a different frame rate) and you can get weird behavior from that.
i don't know if you're still responding to the comments or if someone here can explain it to me but for the head collision i tried to make use of the static raycast function but with vector2.up and it didn't work.Anybody got a clue ? i want to essentially create a circle collider at the head of mario and check if his head bump into object,isnt that better than using the whole body collider ?
uhh so i cant see mario when i press play, anyone know why?
do you have the answer same here, my mario is just falling infinitly
I had the same issue where my mario was falling down infinitely after pressing play. The problem was that my collider for the ground blocks was not placed correctly. Idk if this will help but I hope you found a solution otherwise.
@@КристинаКоручева thanks
27:49
lets goooo
My Mario's head is sticking to the blocks like a magnet, he can move and when moving out from under the block he falls to the ground. In the debugger I noticed it registers him as grounded when his head touches the underside of the block. Anyone know why?
check the radius and distance inside Raycast, you should first set the boxcollider size to 0.25, and then measure its way down to the ground block, see how much the Y value changes, which should be the value of the float distance i mentioned above.
By doing so you limit the collider area of your mario to the bottom half of his body instead of from head to toe.
When I add the raycast bool in the playermovement script it says that the rigidbody.Raycast doesn't exist
Same broo
Your prob is solve ??
Any solution bro
@@Alone....7n7 I don't know
gotta have the Extensions file in the same folder as your movement script
(*help)
Done till 50:01 added everything side scrolling , player movement and extension now my character is not moving and there is no error, earlier the character would move left and right and camera as well
(*help)
same issue with me brother
I had problems with the running animations, every time when i stopped running and started running again it seemed like my framerate doubled. I fixed this by changing the OnEnable function with the start function. Does anyone have a idea why this happened?
after 2 hours of searching i found out that I wrote Ondisable instead of OnDisable.
Bro you forgot the fire flower
My Mario isn't moving left or right. Neither does he jump. Please help!