How to make Pong in Unity (Complete Tutorial) 🏓💥

  Рет қаралды 128,967

Zigurous

Zigurous

Күн бұрын

Пікірлер: 509
@Zigurous
@Zigurous 2 жыл бұрын
Visit the GitHub page for the most up to date source code: github.com/zigurous/unity-pong-tutorial View the FAQ for answers to common questions: github.com/zigurous/unity-pong-tutorial/wiki
@nowthatsgaming5447
@nowthatsgaming5447 Жыл бұрын
20:53 how did you get the not equal sign?
@necroz08
@necroz08 Жыл бұрын
​@@nowthatsgaming5447!=
@Critical3rror
@Critical3rror 2 жыл бұрын
Small chance this will be seen for those of you using newer versions of the unity editor that use "TextMeshPro" in order to change the text you will have to use the TMPro library and make your text variables be "TMPro.TMP_Text" instead of "Text" then you can drag your TMP's into their corresponding places in the game manager object
@BoryslavMalishevskyi
@BoryslavMalishevskyi Жыл бұрын
your effort was appreciated!
@abadbitchwithdreads
@abadbitchwithdreads Жыл бұрын
Also change the using UnityEngine.UI to using TMPro. It should look like this ⬇️ using UnityEngine; using TMPro;
@morrymar3295
@morrymar3295 Жыл бұрын
it has been seen kind man
@Alex.Geornoiu
@Alex.Geornoiu Жыл бұрын
thank you very much for this!
@Stigma536
@Stigma536 Жыл бұрын
how do i do that?
@MrMundharmonikah
@MrMundharmonikah 3 жыл бұрын
I've followed quite a few Pong Tutorials on KZbin now. Some were okay. Some I had to quit because they weren't well enough explained or had other issues. This one was by far the best. I like your calm, logical, almost OCD-type of explaining and showing everything in detail and cleaning up the code. I learned a lot just from this single video and feel encouraged to program my first game now. Thank you so much!
@hilmansantika4873
@hilmansantika4873 2 жыл бұрын
TNice tutorials is one of the best tutorials of ANYTNice tutorialNG that I've ever watched in my life! Thank you so much!
@space9kris
@space9kris 3 жыл бұрын
Second one I've followed, after Snake, going to go through each one. I learned a lot from this and appreciate what your doing. I feel like these smaller games help me to understand the more basic principles. People ask for tutorials on complex games but if they learn how to code a bunch of simpler games, take notes and apply the principles on a bigger scale then eventually they will be able to work these larger ideas out themselves. Someone mentioned Bomberman and I think a Nes style bomberman game could be a really cool fit with the other videos. Keep up the good work and thanks for what your doing!
@reubenoakley8967
@reubenoakley8967 3 жыл бұрын
Hi! I just finished this tutorial, and I wanted to come down here to feed the KZbin algorithm for you! As someone who's just started using Unity and had essentially no prior knowledge of coding, I found this to be a fantastic way to learn and practice both. I've subscribed and will definitely be checking out your other videos, thanks a ton!
@kwipxd
@kwipxd 3 жыл бұрын
This has gotta be the best tutorial ive seen for unity, so easy to follow and your content is insanely high quality. Keep it up!
@michaelpuskar6975
@michaelpuskar6975 2 ай бұрын
Appreciate your thoughtful and methodical tutorial. Around 24:00 a couple of notes: first, square magnitude cannot be negative, so a simple > 0 would be sufficient. Second, since the vector will only ever be changed on the y-axis, a more efficient method would be to just check if _direction.y != 0.
@tayfunyirdem
@tayfunyirdem 3 жыл бұрын
AWESOME! Best game development tutorial series i've ever seen.
@jeremyadriel1509
@jeremyadriel1509 3 жыл бұрын
Bro thanks for this tutorial , Its my first game that I creat in unity a you did a very googd job👌
@kylebelonoac3831
@kylebelonoac3831 2 жыл бұрын
obsessed with soft design now and more obsessed with cool scales Nd stuff.
@ohmygigglez4464
@ohmygigglez4464 3 жыл бұрын
Great tutorial! It really helped me out! I'm completely new to programming, and I've started and stopped Unity several times in the past because I just couldn't get my head around it and coding. Thanks to you I finally finished a project!
@ПётрЗиновьев-г1ж
@ПётрЗиновьев-г1ж 3 жыл бұрын
Great tutorial! Not only the tutorial itself is made with some quality, but the guy also takes some time to explain everything in detail. Looking forward to future videos :) Thanks!
@cool-aquarian
@cool-aquarian 2 жыл бұрын
Thumbnail got my expectations high, thought it was the usual ping pong across a table.
@maxriley1769
@maxriley1769 3 жыл бұрын
Incredibly useful content. You deserve views.
@jesusbarrios2323
@jesusbarrios2323 2 жыл бұрын
It's great that there are people like you.
@sofiaanabela
@sofiaanabela 2 жыл бұрын
Blakey Don't stop making soft. I wished I started as early as you. You have a lot of years to learn!
@uniKorn8
@uniKorn8 3 жыл бұрын
Pong completed yesterday. Tutorial was very clear for beginner like me 👍 I even managed to create player 2 paddle script and replaced it with computer script today, can now play with a friend. Keep up the good work! next up Asteroids 🚀
@occularmalice
@occularmalice Жыл бұрын
An enhancement you can do is to have the computer play against itself. You'll probably have to adjust the speed of each paddle so they're not so evenly matched (maybe by using a random speed) but all it takes is a minor change in the ComputerPaddle script. In the FixedUpdate method rather than determining if the ball is moving to the right (and thus it's moving towards the computer paddle so act accordingly) you can determine the direction of the ball relative to the paddle. Then you can act based on that instead, otherwise if you use the system as-is, the computer paddle will just sit idle at the center when it's on the left side of the screen. So instead of checking if(ball.velocity.x > 0f) you need to determine if the ball if moving towards or away from the paddle. This is pretty easy using the dot product of the relative velocity and the direction between the two objects. // calculate the direction from the ball to the paddle using the position of each object Vector2 ballDirection = transform.position - ball.transform.position; // calculate the relative velocity between the two objects Vector2 relativeVelocity = ball.velocity - rigidbody.velocity; // calculate the dot product of the two float dotProduct = Vector2.Dot(relativeVelocity, ballDirection.normalized); if(dotProduct > 0) { // ball is moving towards paddle } else { // ball is moving away from paddle } Now you can adjust the paddles y position accordingly regardless of where it is on the playing field. PS KZbin code comment and my brain syntax may be wrong Enjoy!
@jackhearts9827
@jackhearts9827 2 жыл бұрын
Learning C# and Unity and this was so much fun and very easy to follow, thankyou so much.
@seanhunt4994
@seanhunt4994 2 жыл бұрын
Hello everyone, I am new to programing. I got stuck on this video around 1:07 because we now have a newer version of Unity. I realized there was no (text UI icon). I figured it out if anyone else is having issues. Right click in the (Hierachy). On the drop down menu click on UI and select (Canvas). Once opened, select Canvas and right click to open a new empty game object. Make sure the new empty game object is a child on the Canvas in the Hierachy. Select your new empty game object. Change it's name to Player Score. Once opened, select add component (Text). That should place you back on track with this video. Very good tutorial thank.
@nabilraaa
@nabilraaa 2 жыл бұрын
normally i dont give reviews but maam youre amazing
@raihanhossan5677
@raihanhossan5677 2 жыл бұрын
Thanks for the tutorial, it's much faster than any other method I came across.
@unsus3D
@unsus3D 14 күн бұрын
Thank you for this tutorial i learned a lot of things as a beginner.
@ferronferron9154
@ferronferron9154 3 жыл бұрын
thank u very much this is my first project your helping a lot
@Liforus1
@Liforus1 3 жыл бұрын
Best tutorial I've ever seen. Thank you!
@grandsuzuki
@grandsuzuki 3 жыл бұрын
Yes, I build my First game in Unity. Thanks for Explaning there is so mutch to learn. 😃
@dennischong7915
@dennischong7915 2 жыл бұрын
when i typed in soft soft tutorial i did not expect it to be tNice tutorials good thank you so much aaaaaaa
@theemeraldsloth9570
@theemeraldsloth9570 2 жыл бұрын
Just finished it. It was great. Thanks.
@CheeseWithMold
@CheeseWithMold Жыл бұрын
A clean, simple, and very relaxing tutorial! Well done and thank you!
@aussiedev5930
@aussiedev5930 3 жыл бұрын
I added mouse paddle controller for mobile controls :), looking to set a max score for game over. I'll add extra features once I finished all your tutorials I might get some good ideas. Awesome tutorial.
@Saksham0412
@Saksham0412 2 жыл бұрын
hello could you help me that, like explain me how to script touch controls
@aussiedev5930
@aussiedev5930 2 жыл бұрын
@@Saksham0412 use mouse controls they work for touch
@Saksham0412
@Saksham0412 2 жыл бұрын
@@aussiedev5930 u on linkdin or insta
@brisben88
@brisben88 3 жыл бұрын
Thanks for a great tutorial, hope your channel grows cause you've helped me a lot!
@sebastianantonelli9166
@sebastianantonelli9166 3 жыл бұрын
Best tutorial ever! Thank you for the learning experience!!!
@mrgoogle1678
@mrgoogle1678 2 жыл бұрын
TNice tutorials was great! the way you explain tNice tutorialngs and repeating it really helps. thanks for the tutorial!
@zingaali5642
@zingaali5642 2 жыл бұрын
Nice tutorial Michael,
@rockinrandalf
@rockinrandalf 2 жыл бұрын
Great Job, thank you, I've learned a lot. Please keep on uploading your high quality videos.
@agminga_yt6100
@agminga_yt6100 2 жыл бұрын
Thank you for your complete and comprehensive training. Very good!
@HKragh
@HKragh 3 жыл бұрын
Having not seen the entire tutorial, it may be you address what I am about to comment on :) First of all, what a great series... I do however feel like in this the collision between the bats and the ball is wrong. In the original game the ball would always be sent back based on where on the bat it hit. So if the ball hits on the top of the bat, the ball will bounce upwards no matter what direction it has when it collides. Here it seems it is entirely a standard reflection you calculate. So the ball will always move around at the same angle in your version, and as a player you are not able to send the ball back from where it came. When I made Pong a couple of months back I defined a circle with a given radius (Still using the bats box collider as a trigger of a collision, but not reflecting), and then sent the ball back using this circle construct. Like if the bat was a circular curve. While I don't have the original game, it more close resembles what I see in videos showing the original.
@Zigurous
@Zigurous 3 жыл бұрын
You are correct. The collision here is actually not accurate to the original game. I'm going to be making a Breakout tutorial soon, which is very similar to Pong, in which I will implement the correct physics.
@claudionevesvideomaker3945
@claudionevesvideomaker3945 2 жыл бұрын
I checked - everything is clean
@mediatv111
@mediatv111 2 жыл бұрын
Best channel for Unity tutorial, thank you!
@SharifAlramahi
@SharifAlramahi 2 жыл бұрын
Hey man thanks a lot. I was really overwheld and confused but now it all makes sense. Thank you.
@KHR0183
@KHR0183 2 жыл бұрын
A very useful lesson for all aspiring softians
@adeelbashir824
@adeelbashir824 2 жыл бұрын
this channel deserves 1m+ subs
@CheetehZ
@CheetehZ 3 жыл бұрын
awesome tutorial! Helped me make my first game in unity :)
@PrinceDade
@PrinceDade 5 ай бұрын
Thank you so mucj man. I'm starting to learn how to code in Unity 3D and I should say that I love your way of explaining things. Did you do also any 3D game or only 2D games?
@slug7756
@slug7756 3 жыл бұрын
Thank you for taking the time to make this Zigurous! This worked for me with no issues. I used unity version 2020.3.14f1. Looking forward to going through the other videos!
@syedimaad363
@syedimaad363 3 жыл бұрын
Just finished making this, thank you so much
@vaidyanathb342
@vaidyanathb342 2 жыл бұрын
Thanks for this!!!
@dimitris01n
@dimitris01n Жыл бұрын
At 56:48 ball was bouncing in the same y level for ever probably. Any fixes?
@celestinofreitas3733
@celestinofreitas3733 Жыл бұрын
thanks a lot for this tutorial it was one of the best things that I've seen, I've been trying to learn unity lately and this was a huge helper. :)
@casta9069
@casta9069 2 жыл бұрын
Thanks for the Video It encourage to get in Unity
@cerkezkoyfotodeniz1088
@cerkezkoyfotodeniz1088 2 жыл бұрын
TNice tutorials is going in my helpful tutorials playlist.
@RazVlogs
@RazVlogs 2 жыл бұрын
Thank you. Just started with Unity and this helped me a lot. Will continue to learn more from you.
@pronk.
@pronk. 2 жыл бұрын
Fantastic video bro, legend.
@trankimnga4447
@trankimnga4447 2 жыл бұрын
Thanks a lot - your video is a Great start to soft soft. I'm onto it !
@vitobrx
@vitobrx 2 жыл бұрын
This is a perfect tutorial. Thank you!
@zarawjoestar
@zarawjoestar 2 жыл бұрын
Nice video man, clear and concise explanation! Thanks a lot!
@АбдукадирКамилов
@АбдукадирКамилов 3 жыл бұрын
Thank you good lesson I liked it very much I want more
@وليدالحربي-ك1ش
@وليدالحربي-ك1ش 2 жыл бұрын
No virus, real work
@gazzer4461
@gazzer4461 2 жыл бұрын
This is a really good and easy to follow tutorial. Thanks!
@scopez3853
@scopez3853 2 жыл бұрын
TNice tutorials is video is amazing! thanks for posting.
@tomaszjoy5586
@tomaszjoy5586 9 ай бұрын
Amazing tutorial. I have lernt a lot. Thank you.
@heintunzaw5691
@heintunzaw5691 2 жыл бұрын
do more of this!! this is amazing
@relarin952
@relarin952 Ай бұрын
If forever reason at 18:00 you can't attach Player Paddle script to the game object, just take out the space in the name of the script and that should let it work fine!
@hatofuka8078
@hatofuka8078 2 жыл бұрын
I tNice tutorialnk you speak for a good portion of us.
@juliangubbels5217
@juliangubbels5217 3 жыл бұрын
Learned a lot, thanks!
@EpicPoggy
@EpicPoggy Жыл бұрын
can you tell me how you did the "does not equal" symbol at 23:48?
@vlasis.
@vlasis. Жыл бұрын
You can do the same symbol by typing !=
@chanoohh2481
@chanoohh2481 2 жыл бұрын
yours is perfect. These are going to takes loads of ti off the learning process.
@GimmickDW
@GimmickDW 2 жыл бұрын
This method works perfectly .. thanks for sharing ;)
@smeagolfishy
@smeagolfishy 7 ай бұрын
Great tutorial, thanks!
@wckval6878
@wckval6878 2 жыл бұрын
very very gooood, thaaankss maan✨✨✨✨✨✨✨✨✨✨
@SonNguyen-wi3nc
@SonNguyen-wi3nc 2 жыл бұрын
Thank you Mike! I'm just starting out and tNice tutorials video really helped get the basics down!
@DUE1234
@DUE1234 2 жыл бұрын
make more of these i like these kids keep it up
@carlraymarpuri8354
@carlraymarpuri8354 2 жыл бұрын
Installed, everything works, thanks! Like
@SRIRAMCHANDR
@SRIRAMCHANDR 9 ай бұрын
Learned a lot, thanks a bunch for your efforts...
@nine8336
@nine8336 3 жыл бұрын
Great video, thanks for help :D
@TheSteveTheDragon
@TheSteveTheDragon 3 жыл бұрын
Really enjoying your tutorials. Would you consider doing a final-fight/streets of rage or river-city ransom style game in the future?
@Zigurous
@Zigurous 3 жыл бұрын
I'll certainly consider it! Those will probably be a little more advanced.
@josepmariamiradadonisa5705
@josepmariamiradadonisa5705 2 жыл бұрын
Installed, everything works, thanks!
@instantlydrop5364
@instantlydrop5364 2 жыл бұрын
You explain it really very well. I thank you! Your video helps me a lot in learning.
@BoryslavMalishevskyi
@BoryslavMalishevskyi Жыл бұрын
i hope one day youll get a million subscribers:)
@alperen_101
@alperen_101 3 жыл бұрын
This kind videos so useful ,keep going same..
@bengisunalnc7295
@bengisunalnc7295 2 жыл бұрын
Bro! it's Amazing You solved my problem! Thanks!!!
@Hugoishere0911
@Hugoishere0911 7 ай бұрын
thank you for the effort! Love your tutorial !
@jeremiahquintano4537
@jeremiahquintano4537 2 жыл бұрын
Thanks for explaining it really well! I've been putting off learning soft soft cuz it looks so intimidating but now that I easily understood the
@remonsebastian5370
@remonsebastian5370 2 жыл бұрын
thank u helped me a lotNice tutorial.... Very helpful
@macmartinez2
@macmartinez2 6 ай бұрын
Excellent video. THNKS😁
@yasseraltamimi6171
@yasseraltamimi6171 2 жыл бұрын
I'm glad I found your channel, I love the way you explain everything you're doing and at the same time not treating us as idiots by explaining the obvious as how other beginner tutorials do. Just a simple question, going by your structure of code, how would you go about implementing that at the beginning the ball goes random x and y, but when one side scores the ball goes to the who conceded and still in a random y?. I hope it's clear what I'm asking :) Thanks!
@zd3nnis880
@zd3nnis880 2 жыл бұрын
works perfectly, thank you
@WillyFanGirlOsu
@WillyFanGirlOsu 2 жыл бұрын
Hey man, It works great and without any problems.
@ameri111
@ameri111 3 жыл бұрын
Hi I love the tutorial and am planning on adding a few extra features for personalization! do you know how I would go about to making it so the increasing velocity of the ball doesn't go past a certain value? If it goes past enough it just goes right through the paddle/rigidbody.
@Zigurous
@Zigurous 3 жыл бұрын
Before adding a force to the ball, check the speed is less than some maximum value you determine using an if statement. You can get the speed of the ball like so: ball.rigidbody.velocity.magnitude
@sachiyukinaa
@sachiyukinaa 2 жыл бұрын
Cool! Downloaded))
@fakhrioficial8061
@fakhrioficial8061 2 жыл бұрын
You are the boss bro!!! Thank you a lot!
@emsido5932
@emsido5932 3 жыл бұрын
Bro you are amazing!
@supermoto101
@supermoto101 2 жыл бұрын
At 1:15.45, I am able to assign Game Objects for Ball, Player Paddle and Computer Paddle but not for Player Score Text and Computer Score Text. I know that in the hierarchy, these items are called Player Score and Computer Score. I tried renaming them to Player Score Text and Computer Score Text but this did not help. Any help appreciated.
@twinkalpatel3894
@twinkalpatel3894 2 жыл бұрын
Hey, even I am facing the same issue, are you able to resolved it or not?
@MM-ye7og
@MM-ye7og 2 жыл бұрын
Thanks for the video, very helpful and well explained. Off to make so soft
@_FunkyDude
@_FunkyDude 2 жыл бұрын
When making the ball go faster with each hit, I noticed when you checked the velocity your ball starts off much faster than mine and even increases with each hit more than mine yet I have the same code. Could that be our machines? I'm running on 14' macbook pro 2021. Your velocity starts around 4-5 and increases around .2 each hit, Mine starts around 3 and increases by .1 Also why does the X value only increase with a paddle hit? Thank Man! Great Tutorial!
@_FunkyDude
@_FunkyDude 2 жыл бұрын
FIXED: For some reason I just have to adjust the bounceStrength values on the paddles and walls. Maybe its a machine difference issue, but switched to 25 on the paddles and 15 on the walls and feels much better.
@l0rdgeo413
@l0rdgeo413 2 жыл бұрын
looking forward to learning from the rest of your v
@cliffhardy8431
@cliffhardy8431 Жыл бұрын
Hello. Thanks for the tutorial! It's really helpful and detailed. I'm having an issue getting the computer paddle to run the script. Right now it's now moving at all. I dragged the Rigidbody from the ball into the script component and I'm pretty sure the script is the same as in the video. Any ideas of what might be wrong?
@sta.josefaagusandelsur6878
@sta.josefaagusandelsur6878 2 жыл бұрын
willing to learn. Unless you already understand setups, then I gues sit's gonna be easier, but as a classically trained pianist I was blown
@savasozturk00
@savasozturk00 2 жыл бұрын
Great tutorial, I completed in 8 hours but learned lots of things. My advice for new ones is to follow videos carefully and implement immediately instead of copying and pasting the code from github. The cleaned code in github includes some errors and lacking parts, It's loaded without being tested. Now, I have a working Pong game and I'm ready to use it in my reinforcement learning experiments. By the way, zigurous's style of computer paddle intelligence is pretty successful indeed although it is very simple.
Unity For Total BEGINNERS - Make Pong in 10 Minutes!
10:01
bananadev2
Рет қаралды 5 М.
How to make Snake in Unity (Complete Tutorial) 🐍🍎
47:24
Zigurous
Рет қаралды 196 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
THE AMAZING DIGITAL CIRCUS - Ep 4: Fast Food Masquerade
23:20
GLITCH
Рет қаралды 39 МЛН
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,3 МЛН
How I learned Unity without following tutorials (Developing 1)
18:11
Game Maker's Toolkit
Рет қаралды 2,1 МЛН
How to make Space Invaders in Unity (Complete Tutorial) 👾🛸
1:25:17
Unity 6 is OUT! Who won the Unity Awards?
12:16
Code Monkey
Рет қаралды 14 М.
Running "Hello World!" in 10 FORBIDDEN Programming Languages
18:07
Making a Game in ONE Day   (12 Hours)
10:26
Dani
Рет қаралды 3,4 МЛН
I Spent a Week Making an AI's Video Game Idea
17:51
Sebastian Lague
Рет қаралды 3,2 МЛН
20 Programming Projects That Will Make You A God At Coding
14:27
The Coding Sloth
Рет қаралды 1,5 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН