How to make Brick Breaker in Unity (Complete Tutorial) 🧱🏓

Поделиться
HTML-код
  • Опубликовано: 5 авг 2024
  • Learn to make the classic 2D arcade game Brick Breaker in Unity. Brick Breaker is a clone of the classic arcade game Breakout which the player must smash a wall of bricks by deflecting a bouncing ball with a paddle. When all the bricks have been destroyed, the player advances to a new, harder level. The player gets 3 lives to start with; a life is lost if the ball hits the bottom of the screen. If all lives are lost, the game is over.
    0:00​ - Introduction
    1:00​ - Project Creation
    1:51 - Scene Setup
    5:01 - Loading Levels
    13:43 - Level Design
    29:32 - Paddle Movement
    38:13 - Ball Movement
    45:28 - Bounce Reflection
    58:55 - Brick States
    1:09:35 - Scoring
    1:12:55 - Player Lives
    1:25:02 - Level Completion
    1:33:50 - Outro
    🖥️ Source code and assets: github.com/zigurous/unity-bri...
    👍 Subscribe for more Unity tutorials: ruclips.net/user/zigurous?sub...
    💬 Join our Discord community: / discord
    👑 Become a Patreon supporter: / zigurous
    ❤️ Support my work: www.paypal.com/donate?hosted_...
    ⭐ Download my Unity assets: zigurous.com/assets
    ········································­­·······································­·­····
    ► Learn more about my work: zigurous.com
    ► Follow for news and updates: / zigurous
    #unity #unitytutorial #gamedev #unity3d #unity2d #gamedevelopment #indiegame #indiedev #madewithunity

Комментарии • 118

  • @Zigurous
    @Zigurous  2 года назад +7

    Visit the GitHub page for the most up to date source code: github.com/zigurous/unity-brick-breaker-tutorial
    View the FAQ for answers to common questions: github.com/zigurous/unity-brick-breaker-tutorial/wiki

  • @user-hd2ft2br9c
    @user-hd2ft2br9c 4 месяца назад +2

    Namaste from India! i have been searching such tutorial. thanks ! u r amazing.

  • @TheGreatZeemo
    @TheGreatZeemo 2 года назад +20

    You make some of the best unity tutorials! Thank you so much for what you do!

  • @gonzalo635
    @gonzalo635 2 года назад +4

    I havent found a better introduction to Unity in all of ytb. Great videos :)

  • @alimoammeri9483
    @alimoammeri9483 Год назад +2

    Great tutorial! It's not just about brick breaker, it also contains best practices on how to develop a game. I learned a lot, thanks

  • @tayfunyirdem
    @tayfunyirdem 2 года назад +2

    AWESOME! Best game development series i've ever seen.

  • @hlimajunior
    @hlimajunior 2 года назад +2

    Thank you, man! I am very happy for find your channel. My mind is blowing now, with many ideas to implement in this game (ball speed, invencible for a X seconds, some sounds, and visual effects, etc).
    Let´s code!
    A hug from Brazil

  • @manusburke4765
    @manusburke4765 Год назад +4

    I have been looking for a good and simple method of Bounce Reflection for ages, your few lines of code really brings this game to a new level. Thanks a million

    • @Will8350
      @Will8350 8 месяцев назад +1

      Another idea is to take the Collider, make it a Polygon instead of a Box and make a sort of pyramid shape

  • @OmeedNOuhadi
    @OmeedNOuhadi 2 года назад +4

    Thank you for sharing your Unity Tutorial!!!

  • @juliangubbels5217
    @juliangubbels5217 2 года назад +3

    Learned so much, thanks!

  • @durvids474
    @durvids474 2 года назад +2

    This is amazing content, thank you so much! Subscribed!

  • @seanhunt4994
    @seanhunt4994 Год назад +1

    Thank you again Zigurous

  • @novaboogaloo2
    @novaboogaloo2 Год назад +2

    Great video, helped a ton with college work

  • @sachinkankane9877
    @sachinkankane9877 2 года назад +4

    Very very helpful tutorial 🔥

  • @cx717cx717
    @cx717cx717 4 месяца назад

    Great tutorial.
    Thank You!
    In about 1986 - 1987 "arkanoid" was my lovely PC game. I was 7 years old.
    ( I already subscribed )

  • @AboFroos
    @AboFroos 2 года назад +1

    Great Tutorials ❤❤

  • @dwadthechad
    @dwadthechad 2 года назад +2

    Yes! a new video :)

  • @_game_x7847
    @_game_x7847 2 года назад +7

    No doubt, u are the next even better brackeys!.. keep it up and make more of these awesome tutorials!!

  • @TransGuyShane
    @TransGuyShane 2 года назад +7

    These tutorials are super helpful ♡
    I've been making games for afew years and struggle with coding but these videos are super easy to follow along and the whole tutorial being in one video is extremely useful as I know by the end of the video I will have a working game.
    I have afew tutorial ideas,
    ● Making the games you've already made have android controls like buttons or joystick:)
    I've made afew of the games now and am trying to make them into a mobile app but it is a little difficult as like I said I am rubbish at coding haha.
    ●Sonic - a tutorial on how to make a game like the original sega sonic game would be awesome.
    ●Pokemon - an rpg like pokemon or similar turn based combat system.
    ●A puzzle game like pipe mania or match game like Bejeweled.
    Just some thoughts :)
    Can't wait to see what we are going to make next ♡

  • @sonilpro8526
    @sonilpro8526 2 года назад +3

    Another video, yes😁

  • @gautamgarg7377
    @gautamgarg7377 2 года назад +4

    Thanks for the amazing tutorial. Please make a side scroller for the next one.

  • @adamabbott2014
    @adamabbott2014 Год назад

    your vedio is amazing! thank you very much~

  • @samuelporto4391
    @samuelporto4391 2 года назад

    Muito bom o tutorial!! Parabéns pelo trabalho 👏🏾👏🏾

  • @ThiagoNeres1
    @ThiagoNeres1 2 года назад +3

    Great tutorial!
    I'm building a brick breaker and while I didn't watch this before starting, I see a lot of logic similarities.
    What's making me scratch my head is the bounciness on brick collisions. I want collisions with the paddle to affect direction/angle, but collisions with bounds and bricks should only invert rb velocity X or Y depending on where the ball hits (sides or top/bottom of a brick).
    Setting bounciness to 1 and friction to zero does that, but it glitches and changes the direction if the ball hits the edge of a brick or if it hits between two bricks.
    Do you have any theories of why that happens or how to fix that?

  • @romilg4978
    @romilg4978 Год назад +2

    @Zingurous, how would you do the BounceReflection function for the same game but in 3D using box colliders and sphere colliders and Vector3s ?

  • @AchimTheEagle
    @AchimTheEagle Год назад +1

    Well, I really like the structure of your tutorial. It is a great tutorial in general but the way you approach this will make many new coders lose their minds. ^^ Imagine someone wants to add "special" bricks (one that expands or shrinks your paddle or spawns a second ball or something like this) your one script for all bricks approach will backfire hard.

  • @Atrainfr
    @Atrainfr 2 года назад +1

    This is the Fifth tutorial that I've watched of yours, and im happy to report that I hit one of my milestones that i set for myself. I coded a entire script for this all by myself, which really boosts confidence, thank you SO much for your helpful tutorials and I cant wait for more. Might I suggest making a dungeon crawler or something with melee/ranged combat in it? Because I'd love to watch that and branch off of it and make a fighting game of my own :) But like I said, thank you so much man for all of your help and devoting your time to helping all of us. 100% Subscribing.
    edit: I forgot to add, that script that you put in github to fix the slowing down bug doesn't work for me, it makes my ball go 900 MPH and fly off my screen (past my walls with colliders) even when its on 0.01 speed, I also tried 10 speed and the regular 500, nothing works, could you maybe tell me how to fix it?

    • @Zigurous
      @Zigurous  2 года назад

      I appreciate your support!
      For the ball, it really just sounds like the speed is too high. Are you setting the speed in the Unity editor? The value in the script only acts as a default, so changing that value after the script has been added to an object won't do anything. You'll have to set it in the Unity editor. And if your game has multiple levels/scenes, then likely you'll need to change the speed in a couple places.

    • @syedhashir7688
      @syedhashir7688 Год назад

      Right same problem here

  • @nickmalialis6
    @nickmalialis6 2 года назад +1

    This is a great tutorial. Thank you. Would you be able to remake Number munchers? That would be amazing!

  • @sterling709
    @sterling709 2 года назад +2

    would look to see you will do at least once the UI table, and when UI table is open the game pause/gameover restart, thumb up with bricks

  • @gmun
    @gmun Год назад +1

    the ball always finds a way to get stuck at or at least reduce its trajectory to ~90 degrees i assume, which causes it to bounce between walls indefinitely. Is there any way to restrict it from ever bouncing at like 89-91 degrees or something?

  • @shaynebates7190
    @shaynebates7190 2 года назад +1

    Adding a comment to help with the algorithm

  • @dannyb2344
    @dannyb2344 2 года назад +4

    I’m having a problem and was wondering if there’s a way you could help. So I decided to use the Unity sprites instead of using your assets just to see if it would work but after I finished typing out the code for the bricks, when ever I press play the bricks just turn invisible but the ball can still hit them.
    I went over my code and looked over the video and I’m pretty sure the code matches but I could be missing something. I’m also pretty sure I changed where Sprite and sprite was with Color and color.
    I made sure to check that the background was still a negative number which they were so I’m not sure if I just missed so,etching or if it could be because I made custom colors but I doubt that’d be the case.

    • @raoasim4927
      @raoasim4927 2 года назад

      check if you have disabled the brick gameObject by default.... and if you have disabled it, enable it in the start method

  • @Meithighs
    @Meithighs Год назад

    I'm not sure if you did this throughout the video but you didnt appear to during the ball movement, I couldnt figure out how to constrain my ball from gaining too much velocity when hit weird with the paddle. When I wanted to set the velocity to a maximum I ran into the issue of not knowing how to because it would be going in positive and negative dirrections at different times... so realistically if I decided to do it my way I ended up forcing the capped number when reached to just vector2 the ball into oblivion up into the top right corner of the screen because I thought just putting a max on the velocity would fix it.. clearly that was a bad idea but I am stumpt

  • @carlosro5133
    @carlosro5133 2 года назад

    Hello!
    How can I display the score and lives?can you give me some indications?
    Thanks!

  • @nikolaziljianrevodevara713
    @nikolaziljianrevodevara713 2 года назад

    Your video helped me A lot. can you make a UI Score for the game?

  • @theeffedgamers5035
    @theeffedgamers5035 Год назад

    whenever I put in maxbounceangle into the script it gets an error, what am I doing wrong?

  • @xavierbourguignon37220
    @xavierbourguignon37220 2 года назад

    Adam, the 3 dot menu is called an ellipsis :)

  • @mohdsajidshaikh4291
    @mohdsajidshaikh4291 Год назад

    Hello, i want help how to move ball on XZ plan in 3d on plane. i want same effect of bouncing balls on wall

  • @danielkapanadze
    @danielkapanadze 2 года назад

    Hello i have a question my ball when it hits bottom i dont lose lives why?

  • @stefanolasio6496
    @stefanolasio6496 Год назад

    Hello, great tutorial, congratulations.
    How can I control the speed of the ball, based on how I hit the ball, it tends to change speed, how can I control the speed so that it does not exceed a maximum value and return to a minimum value? Thanks

  • @buzzingcolors1507
    @buzzingcolors1507 2 года назад +4

    Hey, thanks for the great tutorials! I have a question about the ball movement - after a while it gradually slows down. Do you have any idea why that happens? Given that there's no gravity and I've also added the "Bouncy" physics material to both bricks and walls, I don't understand it. Does the initial force "wear off" after each collision, is it part of the built-in Unity physics system? And do you have any suggestions on how to keep a fixed and steady speed of the ball? Thanks in advance :)

    • @megasonico514
      @megasonico514 2 года назад

      Same problem here

    • @Zigurous
      @Zigurous  2 года назад +5

      I've started to put together a wiki/faqs, and there are a couple answers that relate to this problem. Check it out here: github.com/zigurous/unity-brick-breaker-tutorial/wiki

    • @megasonico514
      @megasonico514 2 года назад

      @@Zigurous Thx

    • @TnT3Ds
      @TnT3Ds 2 года назад

      I am not sure why, but it looks like unity was overriding my coded speed value with the unity editors which wouldnt update. If i removed the script and re added it the new speed would come though, thank you for this tutorial it was super handy! Easy subscribe

  • @osaruweseokoh6381
    @osaruweseokoh6381 Год назад

    I have a problem
    Ever time I start the Global scene with the game manager script it never loads level one

  • @snrdell1449
    @snrdell1449 2 года назад +2

    It would be even better to have with UI.

  • @raoasim4927
    @raoasim4927 2 года назад +20

    𝑩𝒂𝒍𝒍 𝒔𝒍𝒐𝒘𝒔 𝒅𝒐𝒘𝒏 𝒃𝒖𝒈:
    Make this function in your ball script and then call it in paddle oncollide function at the very end with this condition;
    if (ball.rigidBody.velocity.magnitude < 4)
    {
    ball.SpeedIncrease();
    }
    public void SpeedIncrease()
    {
    switch ((int)rigidBody.velocity.magnitude)
    {
    case 1:
    rigidBody.velocity = rigidBody.velocity * 5f;
    break;
    case 2:
    rigidBody.velocity = rigidBody.velocity* 2.5f;
    break;
    case 3:
    rigidBody.velocity = rigidBody.velocity * 1.6f;
    break;
    case 4:
    rigidBody.velocity = rigidBody.velocity * 1.3f;
    break;
    }
    }

    • @cx717cx717
      @cx717cx717 4 месяца назад +2

      You also can just replace "ball.rigidbody.velocity.magnitude" with number 10 for example
      Instead of:
      ball.rigidbody.velocity = rotation * Vector2.up * ball.rigidbody.velocity.magnitude; // script: Paddle.cs
      write this:
      ball.rigidbody.velocity = rotation * Vector2.up * 10;
      And yes - there is "ball slowing bug" exist. After about 20 ball and paddle collisions ball flying too slow

    • @penciltamaraart
      @penciltamaraart Месяц назад

      @@cx717cx717 Confirm. Any fix yet?

  • @kumatoons5508
    @kumatoons5508 2 года назад +1

    yay

  • @amaya8227
    @amaya8227 2 года назад

    Help! I’m at the last stage of making the game however when I change the states of the bricks nothing happens

  • @ZeroChronicles01
    @ZeroChronicles01 2 года назад +1

    hey dude! i got a idea for an How to make video! "How to make a Bullet Hell in Unity" I never see any good tutorial for those games. I would really like to know how to make a power up system that make my weapons different with every power up, or even level up my weapons !

  • @craigmortell
    @craigmortell 2 года назад +2

    great tutorial much appreciated. I've got a bug that I can't crack. Basically every time the ball hits the paddle it slows down about 5 - 10%. Not happening when the ball hits anything else. I've tried putting the bouncy material on everything and used a debug.log to print out the balls rigidbody.velocity.magnitude and have confirmed that speed is slowing down. Tried using the same debug.log statement within the OnCollisionEnter2d() of the Paddle script both at the start and end of the function and there is no change due to the code in there (i.e. identical magnitude before and after so clearly the magnitude is maintained). Now I'm wondering if there is a setting on the Rigidbody2D or BoxCollider2D I need to change ? am using Unity 2021.2.7f1 version.

    • @megasonico514
      @megasonico514 2 года назад

      Same issue, still working on it...

    • @Zigurous
      @Zigurous  2 года назад +5

      Check out this wiki/faqs I've started to put together for this tutorial. There are a couple answers that relate to this problem: github.com/zigurous/unity-brick-breaker-tutorial/wiki

  • @ivyivyyiivvvyyyyvy
    @ivyivyyiivvvyyyyvy Год назад

    Hi, really appreciate the tutorials!
    I'm confused about lines of code like the function "Hit(Brick brick)" in the GameManager script, which accepts a parameter of type Brick? There's other lines too, like:
    "GameManager gameManager = FindObjectOfType();"
    Where does the type GameManager come from? It's not like that's a type built into Unity, it's just the name of a script. Could someone explain how that works? Because in my mind, it should be like something like:
    "Script gameManager = GameObject.Find("Game Manager").GetComponent();"

  • @yagnikzezariya433
    @yagnikzezariya433 Год назад

    What does meaning of collision.othercollider.bound.size

  • @theeffedgamers5035
    @theeffedgamers5035 Год назад

    how would I do a 3d version and not a 2d one?

  • @trentonstreator7234
    @trentonstreator7234 Год назад

    Assets\Scripts\Brick.cs(34,26): error CS0246: The type or namespace name 'GameManager' could not be found (are you missing a using directive or an assembly reference?)
    its in the right spot but I'm not sure whats causing the issue...
    //...
    FindObjectOfType().Hit(this);
    //...

  • @owenpeery2788
    @owenpeery2788 Год назад

    Great tutorials, when you create a variable, for example speed, then you use it later to control the paddle movement by accessing the rigidbody, why do you multiply it by this.speed? I typically just multiply by the variable itself, speed. I'm mostly self taught so I'm curious if there is a hidden reason for this. I can't wait to make the other videos.

    • @qmerk2661
      @qmerk2661 Год назад

      theres no difference. its just a way to be more precise with what your talking about in the code

  • @youssabemad5824
    @youssabemad5824 2 года назад +2

    A 2D RPG plz

  • @n7pankake236
    @n7pankake236 6 месяцев назад +1

    I usually don't necromancer stuff but, found a bug that for example if you barely hit it and it goes very smoothly to the top it will not bounce down it stays going just left and right endless.

    • @glooring7039
      @glooring7039 6 месяцев назад

      You have to go into Edit -> Project Settings -> Physics2D and lower the Velocity Threshold to 0, as any collision lower than that velocity is considered inelastic.

    • @n7pankake236
      @n7pankake236 6 месяцев назад +1

      @@glooring7039 thanks for the fix and tip

    • @n7pankake236
      @n7pankake236 6 месяцев назад +1

      that wroked thank you very much, I got another question I feel the speed of the ball slowly decrease till certain point because it will be very fast and then it slowly goes down any ides ? @@glooring7039

  • @ehabek7
    @ehabek7 10 месяцев назад

    Everything works perfectly EXCEPT there is a weird issue with the scoring system, upon hitting play, the score in the game manager jumps from 0 to 3500, and then it adds points to that, 3600, 3700, etc.. why? I can't find that figure anywhere? If I can't reslove this I'll have to implement some other scoring system, it would be a shame, everything else runs smoothly. What should I change? Why 3500?

  • @robertwhittaker562
    @robertwhittaker562 Год назад

    I followed the tutorial to a 't" and ended up with a ball that gets stuck bouncing straight between two planes, either left and right wall, or top and bottom. Only thing I did differently was use my own pixel assets from aseprite

  • @badiebakiri1294
    @badiebakiri1294 2 года назад

    Can you explain what's the difference between Start() and Awake() ?

    • @adriansmith5241
      @adriansmith5241 Год назад

      Start is called on the frame when a script is enabled just before any of the Update methods are called the first time. Like the Awake function, Start is called exactly once in the lifetime of the script. However, Awake is called when the script object is initialised, regardless of whether or not the script is enabled.

  • @willpunchit272
    @willpunchit272 2 года назад

    Hello! I'm having a problem where I can't add the brick script to the brick prefab. I haven't changed anything inside of the script.
    Edit: I fixed it. I'm not sure how, but I did.

    • @willpunchit272
      @willpunchit272 2 года назад

      Hi, I have another problem. I can't see the states in the editor. Do you know how to fix it or do you need more detail into my problem? I don't mind having to do lots of code to fix it.

  • @byRocksterunderscore
    @byRocksterunderscore 2 года назад

    Can i run this game in android. And is i am need any touch controls for android

    • @Zigurous
      @Zigurous  2 года назад +1

      The game can be built for Android, but you will need to implement touch controls.

  • @georgia17187
    @georgia17187 2 года назад

    I have a problem. States don't appear in editor at the brick (script) component. And my game won't start anymore. please help

    • @Zigurous
      @Zigurous  2 года назад

      If your game doesn't start, that probably implies you have an error in your code preventing it from compiling. This could also be the reason the states aren't appearing in the editor. Your code needs to compile successfully before it will show up. You can try posting your code here and I can identity the problem.

    • @Zigurous
      @Zigurous  2 года назад

      If this is the case, you should get an error message in your console that indicates the file and line of code where the error is happening.

  • @abdulwahhabayoob2157
    @abdulwahhabayoob2157 2 года назад

    thank you for great great tutorial can you to apply ball bounc reflection to mouse grab

    • @Zigurous
      @Zigurous  2 года назад

      I'm not entirely sure what you mean by mouse grab. Could you explain further?

    • @abdulwahhabayoob2157
      @abdulwahhabayoob2157 2 года назад

      @@Zigurous apologize for my bad inglish am planing to control objects position and rotiation with a mouse or touch but when grabing objects with a mouse especially ın 2d mouse grabs the object from the center but I wnat to grab them dipending to the situation for example from the conrner or the some side ı hope I was able to expressthey thıs time thanks for respondes

    • @Zigurous
      @Zigurous  2 года назад

      @@abdulwahhabayoob2157 This sounds like a pivot point problem. By default the pivot point of a game object is in the center of it, thus when you move, rotate, or scale the object it does so at that point.
      There are ways to change the pivot point. Maybe try this tutorial ruclips.net/video/NsUJDqEY8tE/видео.html. That said, I don't think it will fully solve your problem because in your case it sounds like the pivot point would need to change dynamically based on where you grab it. I'm not sure there is a straightforward way to do this without figuring out all the math yourself.

    • @abdulwahhabayoob2157
      @abdulwahhabayoob2157 2 года назад

      @@Zigurous thank you for your response ıts means a lot for me can ı ask you about some book to develop my math for unıty an c# i found some books but they explaining that with python and c++

    • @Zigurous
      @Zigurous  2 года назад

      I don't know of any specific math books that are meant for Unity/C#. I'm sure there might be some available, but in general math should be translatable to any programming language. That in itself is a skill that needs practice. I think it just comes with time I suppose. I have seen people recommend this RUclips channel ruclips.net/user/codingmathplaylists, although once again it is not specifically Unity/C#.

  • @hylea96
    @hylea96 Год назад

    Code for Brick States when using built-in sprites at 1:04:06 DOES NOT WORK.

    • @KurokishiYT
      @KurokishiYT 8 месяцев назад

      check the alpha value of the colors you assigned to the prefab, it should be 1

  • @glitchy489
    @glitchy489 Год назад

    Can you please try to make 2d minecraft in unity

  • @funjustfun1319
    @funjustfun1319 2 года назад

    I tried adding a score ui but for some reason it doesn't work can you help me, i am very confuse

    • @Zigurous
      @Zigurous  2 года назад

      What kind of problems are you running into? Any errors, or just not sure how to do something?

    • @carlosro5133
      @carlosro5133 2 года назад

      did you resolve the problem with the score ?

    • @funjustfun1319
      @funjustfun1319 2 года назад

      @@carlosro5133 Yes, i fixed the issue with the score, i also added some more elements and many more things. Thanks a lot i learned a lot from this video and project. God bless you and keep it up 👍🏻

    • @carlosro5133
      @carlosro5133 2 года назад

      @@funjustfun1319 can you show me your project,maybe?:D I'm working for a school project and I have to add some many features

    • @carlosro5133
      @carlosro5133 2 года назад

      upp

  • @TheMaxcraft1
    @TheMaxcraft1 2 года назад

    I have two things to say:
    1. Make a 3d game plss
    2. Do you recommend visual studio code against visual studio?

    • @Zigurous
      @Zigurous  2 года назад +2

      I prefer using VS Code for it being lightweight while allowing me to customize it for my specific needs through extensions. I can basically use VS Code for any type of programming I do, which makes it easier not having to switch back and forth between different editors. That said, it really is just preference. There is nothing at all wrong with using Visual Studio.

  • @programadorpordiversao3821
    @programadorpordiversao3821 2 года назад +1

    Make a Sonic - The Hedgehog! Pls

  • @bekir51500
    @bekir51500 Год назад +1

    I absolutely have no idea what happening with the ball physics for calculating the angle.

  • @sachinkankane9877
    @sachinkankane9877 2 года назад +1

    Can I use your brick game asset to publish my game 🙏🙏

  • @hammadloombri3659
    @hammadloombri3659 Год назад +1

    why we are using "this" keyword everywhere?
    can't we just say like :
    health = states.length;
    instead of
    this.health = this.states.length ???

  • @HistoryHHT1
    @HistoryHHT1 4 месяца назад

    I did everything and it shows multiple error CS1002, error CS1026, error CS 1525, error CS1003, error CS8641, etc etc

  • @Raid77
    @Raid77 9 месяцев назад

    1:09:56

  • @gokhankaptan8890
    @gokhankaptan8890 2 года назад +1

    If you wanna learn game development, go to unity learn, finish junior programmer, then come here finish all this best tutorials. thanks zigurous.

  • @darkdoom907
    @darkdoom907 Год назад

    1:18:30 OnLevelLoad subscribing

  • @SpoonHD
    @SpoonHD 2 года назад

    37:34

  • @henballzgameplay7619
    @henballzgameplay7619 5 месяцев назад

    Brick States (ignore)

  • @Quacky._.
    @Quacky._. 2 месяца назад

    I just keep getting errors for no reason couldn't make the game at all.

  • @hammadloombri3659
    @hammadloombri3659 Год назад

    plz reply

  • @NeoPatamonX
    @NeoPatamonX 8 месяцев назад

    Nice tutorial!
    As I was playing around with this, I realized that if you hit the ball with the side of the paddle, it would sometimes just cause the ball to keep falling through despite meeting the ball.
    I took a minute to contemplate a solution, and I like what I came up with. Add this to the logic inside Paddle.cs after calculating the bounceAngle:
    if (contactDistance.y / paddle.bounds.size.y > 0)
    ballDirection = ballDirection * Vector2.down;
    What this is doing is being like "Did the ball go past the halfway point of our vertical distance of the paddle? If so, reverse the y direction of the ball direction"
    You might ask "Well, why not always do that?" - it messes up the normal calculation of the reflection angle if you always change it
    "Why are we using Vector2.down"? - because that is (0, -1) - which would probably be more "accurate" because we're multiplying the Vector and reversing the direction. In retrospect, you probably should use a new Vector2(0, -1) to make the code read clearer.
    This is kind of a hacky solution, but I like its simplicity, and it allows your player to hit the ball on the paddle's side and get what they'd expect - the ball to bounce back upwards.

  • @ruslanrakhmanov728
    @ruslanrakhmanov728 Год назад

    You make some of the best unity tutorials! Thank you so much for what you do!