How to make Tetris in Unity (Complete Tutorial) 🧩🧱

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

ความคิดเห็น • 276

  • @Zigurous
    @Zigurous  2 ปีที่แล้ว +26

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

    • @theblackdragon7321
      @theblackdragon7321 2 ปีที่แล้ว

      @Tothegreat PC, but I'm sure you can tweak it so it can run on mobile, but obviously would have to code it for each respective platform (Andriod, Apple, ect)

    • @krupasanchaniya4191
      @krupasanchaniya4191 2 ปีที่แล้ว

      i m having an issue at 1:21:36 where the trtris is moving correctly but when i play the game error is showing as index was outside the bounds of array!! what should i do ??

    • @voltamon8610
      @voltamon8610 ปีที่แล้ว

      @@krupasanchaniya4191 I have a solution to this.......after much effort
      replace the GetWallKickIndex() function with
      \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
      private int GetWallKickIndex(int rotationIndex, int rotationDirection) {
      int wallKickIndex = rotationIndex * 2;
      wallKickIndex = -8;
      return Wrap(wallKickIndex, 0, data.wallKicks.GetLength(0));
      }
      \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
      and then it works.........though I am not sure..if this is an acceptable solution but it worls

  • @FrankDase
    @FrankDase ปีที่แล้ว +11

    Nice that you show the end result at the beginning of your video. I'm missing this in so many tutorial videos.

  • @ChronoStrange
    @ChronoStrange ปีที่แล้ว +4

    Man you can't imagine the useful and valuable that these videos are. I hope that I can pay you back in the future for all the knowledge that you are giving for free!

  • @andrewfedorov9198
    @andrewfedorov9198 2 ปีที่แล้ว +4

    First 20 minutes: "Hmm, seems like a nice tutorial. Gotta be easy probably..." 21:50 oh my god i'm dying xD

  • @superautobus
    @superautobus ปีที่แล้ว +1

    One of the all-around, best unity tutorials I've seen. Thank you!

  • @Manuuu45_
    @Manuuu45_ 3 ปีที่แล้ว +26

    Man, these tutorials are lit! I'm literally learning how to use Unity in no time thanks to you! If I can I'd like to suggest Donkey Kong, and maybe the first Super Mario Bros. and The Legend Of Zelda (even if these last two are maybe a little complex, you can maybe do a tutorial divided in more parts)

  • @dwadthechad
    @dwadthechad 3 ปีที่แล้ว +20

    These tutorials are so so helpful and good quality thank you! Please don't stop making them

  • @llsanjeev
    @llsanjeev 3 ปีที่แล้ว +3

    Mind blowing bro; i made the game literally word by word in 10 hrs. i am newbie to unity.(just installed 10 days ago). and it was marvellous doing the same. thought i made it 5 year ago in c++ directx11 by my own with heavy glitches.(dont know wall kicks and bounds and wrap function.....). Marvelllous job man'

    • @Saksham0412
      @Saksham0412 2 ปีที่แล้ว

      @Tothegreat it would only work on PC because we chose 2D core and not 2D mobile

  • @RoabertG
    @RoabertG 2 ปีที่แล้ว +5

    Incredibly helpful! As someone who's approaching Unity with more of a background in coding, this was exactly the foothold I needed to get started. I appreciated how you left us with a fully functioning "game" but pointed out how there's still so much that could be added. I do feel like there was a good amount of "magic math" that I didn't really understand why we were doing. If you had given us some kind of reference to better understand that math on our own, I would have appreciated it. But as it is, this tutorial helped get me excited to learn more about Unity

  • @Aldeonmoriak
    @Aldeonmoriak ปีที่แล้ว +2

    I made a Tetris game some years ago using JavaScript/html but a number of bugs made me frustrated so I didn't finish the game.
    With your tutorial I made a Tetris game in Godot 4. The concepts and the way you made the game gave me very good ideas how to do it in Godot. Thank you

  • @vladventura1928
    @vladventura1928 3 ปีที่แล้ว +8

    Hope this channel blows up honestly. A few minutes in and I'm already loving it. Much love, I'll make sure to share the channel around

  • @JulianReyesEscrigas
    @JulianReyesEscrigas 2 ปีที่แล้ว +2

    tutorials like this deserve more thumbs up. very well explained

  • @ИльяЛеонтьев-т5ы
    @ИльяЛеонтьев-т5ы 6 หลายเดือนก่อน +2

    Big thanks from one russian student-programmer)

    • @VladislavKomkov
      @VladislavKomkov 6 หลายเดือนก่อน

      Аналогично 🙋‍♂

  • @chickynuggies2739
    @chickynuggies2739 ปีที่แล้ว

    Best tutorial I've seen on using Unity. Thank you sir.

  • @sakshamdixit5509
    @sakshamdixit5509 3 ปีที่แล้ว +26

    Please make a tutorial on bubble shooter

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +20

      That would be a great one to make. I'll add it to the list!

  • @Astro-Drifter
    @Astro-Drifter 4 หลายเดือนก่อน

    Hey! Nice work on the tutorial! I've been doing your others in this playlist, but this one was the 1st that gave me trouble, at no fault of the tutorial of course, I'm still getting the hang of O.O.P(Which I think is fair, all things considered..)
    Anyways, I wanted to personally thank you for all of your amazing work, and tell you that I'll be giving you a shout-out in my next dev log!
    If your interested in watching, lmk!
    Till then, thanks for all the awesome tutorials!

  • @kwipxd
    @kwipxd 3 ปีที่แล้ว +7

    Thank you man, these tutorials are keeping me inspired in gamedev and its helping me get out of 'tutorial hell'

  • @victoriavitoria9536
    @victoriavitoria9536 2 ปีที่แล้ว +15

    I think it would be better if you would explained the moment with data, because it is really difficult to understand the creating blocks moment. It felt like cheating when you follow but cannot understand what happened and why.
    But I want to thank you for this videos. They are great source for learning.

  •  2 ปีที่แล้ว +4

    Thank you so much for the tutorial. I will add up adding some GUI and stuff, but this helped me a lot!
    Thumbs up!

  • @misterkite99
    @misterkite99 2 ปีที่แล้ว +5

    Me at the start: how complicated could tetris be?
    Me at the end: yeah now it makes sense why I couldn't make it by myself...
    Thanks for the tutorial, although I think at times it goes too fast it was very nice.

  • @kwipxd
    @kwipxd 3 ปีที่แล้ว +3

    For some reason at 55:44 my piece moves over the boarder by one then freezes, i tried just lowering the tile map and that fixed the going over the boarder problem but it still freezes when i go to the far right or left

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +1

      It seems like you have an off by one problem. Make sure you have set your board size to match up with your tilemap. In the video we use a 10x20 board. I recommend even numbers too. Your board and tilemap should be position at the origin 0,0,0.
      There could be a problem with your code, but it's hard to say specifically what. In a sense, the code seems to be working but the bounds are not correct. In the Board script in the function IsValidPosition we use the bounds to check if the board contains a tile. The bounds is calculated from your board size. This would be the first place I would look for problems.

    • @chansongpark6259
      @chansongpark6259 3 ปีที่แล้ว +3

      Hey I don't know whether this is helpful or not but I had the same issue and fixed it.
      In Board.cs file, public bool IsValidPosition, check if you typed
      "Vector3Int tilePosition = piece.cells[i] + piece.position;"
      instead of
      "Vector3Int tilePosition = piece.cells[i] + position;".
      I hope it helps.

    • @Sushi-Boy1
      @Sushi-Boy1 2 ปีที่แล้ว +1

      @@chansongpark6259 You're the best person in the entire universe. I know you sent this 3 months ago, so I'm not expecting a reply, but thank you :D

    • @krupasanchaniya4191
      @krupasanchaniya4191 2 ปีที่แล้ว

      @@chansongpark6259 i m having issue at 1:21:36 when i play game and press Q error pop out as index was outside the bounds array ?? what should i do?? help me out!!

    • @Crewlietsful
      @Crewlietsful ปีที่แล้ว

      @@chansongpark6259 DUDEEEEEEEEEEEEEEE thank you so much!

  • @TheRetroCount
    @TheRetroCount 2 ปีที่แล้ว +2

    This was a wonderful introduction into Unity and C#. Thank you :)

  • @abhilashlr9259
    @abhilashlr9259 3 ปีที่แล้ว +3

    Really educational tutorials Adam. I'll become a Patron after making money from the skills you've taught me :p

  • @lokhad3086
    @lokhad3086 ปีที่แล้ว +1

    1:27:27 It's a bad idea to check lockTime in the Step function. If stepDelay = 2 and lockDelay = 0.5 we have lockTime always 2;
    stepDelay = 0.3, lockDelay = 0.2, then lockTime always = 0.3;
    stepDelay = 0.2, lockDelay = 0.3, then lockTime always = 0.4, and so on

  • @phambaoha170
    @phambaoha170 6 หลายเดือนก่อน

    This will be a million-view channel in the future!

  • @akmalahza4951
    @akmalahza4951 2 ปีที่แล้ว +2

    Thank you so much for the tutorial! Its really helping to create a big project

  • @Nuion
    @Nuion 6 หลายเดือนก่อน

    crazy good, elegant code, smart solutions. I love this

  • @richardlongshaw5864
    @richardlongshaw5864 3 ปีที่แล้ว +2

    Great Tutorial As Ever. The 5th one I have done of yours.Will do 'Flappy Bird' next.

  • @xeebeat
    @xeebeat 2 ปีที่แล้ว +1

    Great tutorial was more complicated then expected but u explained it well =)

  • @gs4207
    @gs4207 3 ปีที่แล้ว +3

    Your channel is gonna rock the ceiling !!!!

  • @plasoto
    @plasoto ปีที่แล้ว

    Thank you very much for sharing the very valuable contents. This will help me to understand some basics of Unity, C#, and Tetris! большое спасибо!

  • @kuraifune3303
    @kuraifune3303 2 หลายเดือนก่อน

    I think there is a small error at 1:20:42 where the rotationIndex is passed to the TestWallKicks() function instead of the originalRotation. Because of the way the GetWallKickIndex() function is designed, it needs the original rotation index to find the correct translation values based on the tetromino wall kick data. This is a relatively hard bug to find, unless you are trying some T-spin minis, which depends on the wall kick mechanic of the SRS.
    Otherwise this is a really helpful tutorial, thanks :)

  • @tarutso
    @tarutso 3 ปีที่แล้ว +1

    Incredibly good tutorial. Thank you

  • @tayfunyirdem
    @tayfunyirdem 3 ปีที่แล้ว

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

  • @estellevd7754
    @estellevd7754 3 ปีที่แล้ว +2

    Really clear explanation, but I'm stuck at getting the piece spawned (41:00). I think I have the exact same code and there are no errors, however, the piece won't spawn, and I don't know why.

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +1

      Have you populated the "Tetrominoes" array in the editor on your Board component? If that's not the issue, you could post your code for the Board script here, and I can try to identify and potential problems.

    • @ricvg9386
      @ricvg9386 3 ปีที่แล้ว +1

      I don't know if you still have this issue, it may be that you replaced the for loop that calls initialize in the awake function of the board script. If you iterate as a foreach it won't work, even if the c# foreach iterates through references.

    • @MiMiBrokenbourgh
      @MiMiBrokenbourgh 2 ปีที่แล้ว

      @@Zigurous NullReferenceException: Object reference not set to an instance of an object
      Board.SpawnPiece () (at Assets/Scripts/Board.cs:32)
      Board.Start () (at Assets/Scripts/Board.cs:24)
      code:
      using UnityEngine;
      using UnityEngine.Tilemaps;
      public class Board : MonoBehaviour
      {
      public Tilemap tilemap { get; private set; }
      public Piece activePiece { get; private set; }
      public TetrominoData[] tetrominos;
      public Vector3Int spawnPosition;
      private void Awake()
      {
      this.tilemap = GetComponentInChildren();
      this.activePiece = GetComponentInChildren();
      for (int i = 0; i < this.tetrominos.Length; i++)
      {
      this.tetrominos[i].Initialize();
      }
      }
      private void Start()
      {
      SpawnPiece();
      }
      public void SpawnPiece()
      {
      int random = Random.Range(0, this.tetrominos.Length);
      TetrominoData data = this.tetrominos[random];
      this.activePiece.Initialize(this, this.spawnPosition, data);
      Set(this.activePiece);
      }
      public void Set(Piece piece)
      {
      for (int i = 0; i < piece.cells.Length; i++)
      {
      Vector3Int tilePosition = piece.cells[i] + piece.position;
      this.tilemap.SetTile(tilePosition, piece.data.tile);
      }
      }
      }

    • @ekekw930
      @ekekw930 ปีที่แล้ว

      @@ricvg9386 This solved the issue for me. Any reason why this is the case?

    • @lorenzofiore7438
      @lorenzofiore7438 ปีที่แล้ว

      ​@@MiMiBrokenbourgh i know it is late but i found the solution. In Piece.cs, at line 32 there is a call to an object (Vector3Int) not instantiated. Here is the solution:
      if (cells == null) {
      cells = new Vector3Int[data.cells.Length];
      }
      for (int i = 0; i < cells.Length; i++) {
      cells[i] = (Vector3Int)data.cells[i];
      }

  • @jugibur2117
    @jugibur2117 3 ปีที่แล้ว +2

    Thanks for your effort and sharing your knowledge! Have left a subscription.
    I admit that center-focused positioning on a tile grid tends to irritate me more than a coordinate system from 0 to X (probably because the tiles / pieces follow a top-to-bottom path).
    But as a beginner, there are many things that can be confusing and overwhelming at first.

  • @刘飞-t9o
    @刘飞-t9o ปีที่แล้ว

    Thanks for making this tutorials! Really help me a lot!

  • @yazanjordan3103
    @yazanjordan3103 3 ปีที่แล้ว +2

    hey i am stuck in the 17:57 i cant fine the new tetrmoino in the board script i did the exact same thing but its not there in the editor
    please help
    Edit: Yes i knew why becouse i wrote it with t small cap beside the array it should be written with T not t

  • @TransGuyShane
    @TransGuyShane 2 ปีที่แล้ว

    your tutorials are amazing. id love to see a turn based combat game like pokemon

  • @viporal7898
    @viporal7898 2 ปีที่แล้ว +1

    1:15:27 int wallKickIndex = rotationIndex * 2; did not work for me. I came up with my own working equation: int wallKickIndex = 2*(rotationIndex - direction);. Do you see the discrepancy as I have?

    • @krupasanchaniya4191
      @krupasanchaniya4191 2 ปีที่แล้ว

      i have the same problem when i press Q then error shows as index was outside the bounds of array what should i do?? @Viporal

    • @viporal7898
      @viporal7898 2 ปีที่แล้ว

      @@krupasanchaniya4191 what is Q supposed to do? And which array are you talking about?

    • @krupasanchaniya4191
      @krupasanchaniya4191 2 ปีที่แล้ว

      @@viporal7898 CS0122 error is showing as Inaccessible due to protective level at the stage of steps and locks..it says that board.SpawnPiece is inaccessible due to protection level.. now what should I do ?Help me out !!

    • @viporal7898
      @viporal7898 2 ปีที่แล้ว

      @@krupasanchaniya4191 you're trying to access a private variable from another script. The variable must be public for it to be accessable by other classes.

    • @krupasanchaniya4191
      @krupasanchaniya4191 2 ปีที่แล้ว

      @@viporal7898 private void Step()
      {
      this.stepTime = Time.time + this.stepDelay;
      if(this.lockTime >= this.lockDelay)
      {
      Lock();
      }
      }
      private void HardDrop()
      {
      while (Move(Vector2Int.down))
      {
      continue;
      }
      Lock();
      }
      private void Lock()
      {
      this.board.Set(this);
      this.board.SpawnPiece();
      }
      private bool Move(Vector2Int translation)
      {
      Vector3Int newPosition = this.position;
      newPosition.x += translation.x;
      newPosition.y += translation.y;
      bool valid = this.board.IsValidPosition(this ,newPosition);
      if (valid)
      {
      this.position = newPosition;
      this.lockTime = 0f;
      }
      return valid;
      }
      what would be the correction over hear ?

  • @JobinJeeji
    @JobinJeeji 7 หลายเดือนก่อน

    Thank you so much for the tutorial. Although I would recommend to show some slides or pictures on what you are going to do before writing code Instead of writing alot of code and finally showing in the editor.

  • @spyrosyt2860
    @spyrosyt2860 2 ปีที่แล้ว +1

    in 42:29 on the spawn positions i type the same cordinates as you and the tetrominoes are not spawning in the top of the board

    • @Zigurous
      @Zigurous  2 ปีที่แล้ว +1

      If you post the code for your SpawnPiece function, I might be able to tell what the problem is.

  • @MAGNETO-i1i
    @MAGNETO-i1i ปีที่แล้ว

    Dude, this video is amazing! Thank you

  • @creeperskydiver
    @creeperskydiver 2 ปีที่แล้ว +2

    54:44 The movement does not work for me

    • @CENAZORpc
      @CENAZORpc 6 หลายเดือนก่อน

      SAMEEEEEE!!!!

  • @007RussianMafia
    @007RussianMafia 2 ปีที่แล้ว

    At 1:01:00 why is a Wrap method necessary? I think a normal modulo would do the trick: `this.rotationIndex = (this.rotationIndex + direction) % 4`
    The Wrap would make sense if your bounds were something weird like 3->6 and you needed 7 to map back to 3. In this case the bounds are simple [0,3] so Wrap seems like overkill

    • @Zigurous
      @Zigurous  2 ปีที่แล้ว

      If I recall correctly I believe the issue is that this doesn't work for negative numbers. If the index is 0, and you rotated left (direction = -1), then (0 + -1) % 4 = -1 which is an invalid index. The wrapping function in the tutorial supports going in either direction.

  • @蔡小英-r2r
    @蔡小英-r2r 2 ปีที่แล้ว +1

    when TestWallKicks,I find that passing originalRotation instead of rotationIndex will return the right Wall Kick Index.

  • @ismael637
    @ismael637 2 ปีที่แล้ว

    Estou gostando do jeito que você ensina! Parabens!

  • @chicorafa
    @chicorafa ปีที่แล้ว +1

    I'm getting an error wehen trying the code in 40:42, with and without this :(
    ERROR:
    NullReferenceException: Object reference not set to an instance of an object
    Board.SpawnPiece () (at Assets/Scripts/Board.cs:30)
    Board.Start () (at Assets/Scripts/Board.cs:23)
    CODE:
    using UnityEngine;
    using UnityEngine.Tilemaps;
    public class Board : MonoBehaviour
    {
    public Tilemap tilemap { get; private set; }
    public Piece activePiece {get; private set; }
    public TetrominoData[] tetrominoes;
    public Vector3Int spawnPosition = new Vector3Int(-1, 8, 0);
    private void Awake()
    {
    tilemap = GetComponentInChildren();
    activePiece = GetComponentInChildren();
    for (int i = 0; i < tetrominoes.Length; i++)
    {
    tetrominoes[i].Initialize();
    }
    }
    private void Start()
    {
    SpawnPiece();
    }
    public void SpawnPiece()
    {
    int random = Random.Range(0, tetrominoes.Length);
    TetrominoData data = tetrominoes[random];
    activePiece.Initialize(this, spawnPosition, data);
    SetTetrominoes(activePiece);
    }
    public void SetTetrominoes(Piece piece)
    {
    for (int i = 0; i < piece.cells.Length; i++)
    {
    Vector3Int tilePosition = piece.cells[i] + piece.position;
    tilemap.SetTile(tilePosition, piece.data.tile);
    }
    }
    }

    • @yichizhang6909
      @yichizhang6909 ปีที่แล้ว +2

      replace activePiece = GetComponentInChildren(); with this.activePiece = gameObject.AddComponent();
      I think the problem is the board doesn't have a Piece children, so we need to add component instead of trying to search from board's children, which will return a null object.

    • @chicorafa
      @chicorafa ปีที่แล้ว

      @@yichizhang6909 I hope you're right, I'll try it :)

  • @uniKorn8
    @uniKorn8 3 ปีที่แล้ว +3

    Another well explained tutorial 👍 You probably have alot of tutorial requests by now. But The original Angry Birds would be really sweet 🐷🐤

  • @theunlicensedspycrab5348
    @theunlicensedspycrab5348 ปีที่แล้ว +2

    For some reason this doesn't allow for t-spins. I even doenloaded your source code to check if it was my mistake, but it doesn't look like it. Could you give me some guidance on what I could do to fix that?
    Edit: the GetWallKickIndex function returned an int that was greater than the result be two (probably because we call it after rotating and not before), so I just had to put a subtraction by two before calling the Warp function, and that solved it.

  • @tipsoh
    @tipsoh ปีที่แล้ว +1

    Hello, i added a simple counter 100pts every line, but how do i implement a system that check if you clean 1 or 2 or 3 or 4 lines at the time and +100 / +300 / +500 / +800pts like the original game ?

    • @incapable_tortoise3703
      @incapable_tortoise3703 ปีที่แล้ว +1

      in the ClearLines loop, count the times if(isLineFull) is triggered, after the loop ends, then calculate the score with the amount of cleared lines that happened

  • @Hugoishere0911
    @Hugoishere0911 10 หลายเดือนก่อน

    thank you for the Tutorial😇

  • @olegparamonov7670
    @olegparamonov7670 ปีที่แล้ว

    Thank you for what you do. Your tutorials are amazing. Could you make the tutorial about chess or backgammon game?)

  • @mirjajdetchernogoumora
    @mirjajdetchernogoumora ปีที่แล้ว +1

    Hi! How to make Tetromino use different textures and not just 1?

    • @SpikeEffect
      @SpikeEffect ปีที่แล้ว

      did you find an answer?

    • @mirjajdetchernogoumora
      @mirjajdetchernogoumora ปีที่แล้ว +1

      @@SpikeEffect nah I didn't

    • @SpikeEffect
      @SpikeEffect ปีที่แล้ว

      @@mirjajdetchernogoumora damn, appreciate the fast reply alot though man.
      I decided to follow another tutorial that showed another method that allowed more than one block texture.

    • @jjeastside
      @jjeastside 11 หลายเดือนก่อน

      You can change the tetromino texture by changing the tetris mino sprites

  • @gokhankaptan8890
    @gokhankaptan8890 2 ปีที่แล้ว +1

    bro you are so good

  • @jagadeeshjaggu4270
    @jagadeeshjaggu4270 2 ปีที่แล้ว

    Bro at 2:56 what you dragged to get those colors please tell

  • @ИльяЛеонтьев-т5ы
    @ИльяЛеонтьев-т5ы 6 หลายเดือนก่อน

    I need to do same tetris program, but i also need to show next falling piece, and i dont kow how i can do that.

  • @amanaplanacanalpanama2414
    @amanaplanacanalpanama2414 ปีที่แล้ว +1

    Hey, I've been loving this tutorial but I have a problem with the mino rotation: the minos rotate around the tilemap origin and not their own origin, so when they move off of the tilemap origin their rotation gets all wonky.

  • @prathamesh_sinha
    @prathamesh_sinha 3 ปีที่แล้ว +2

    Flappy Bird next!

  • @蔡小英-r2r
    @蔡小英-r2r 2 ปีที่แล้ว +1

    great tutorial

  • @hidayet194
    @hidayet194 2 ปีที่แล้ว +1

    hey I can't assign the Piece script in the board I need help

  • @volkanvardar9691
    @volkanvardar9691 2 ปีที่แล้ว +1

    Hello Zigurous, thank you for this awesome tutorial. How can I implement a score when lines are cleared? And show them on the interface? Maybe you explained it in another tutorial?

    • @akmalahza4951
      @akmalahza4951 2 ปีที่แล้ว

      I'm not Zigurous, but I think you still can apply a score, but it will need to resize, create a new part to make the score and don't forget to function it. Again I'm not Zigurous but I need to share my opinion.

    • @anishnaik4663
      @anishnaik4663 ปีที่แล้ว

      @@akmalahza4951 this game is for Android?

  • @JeremiSeihonshi
    @JeremiSeihonshi 2 ปีที่แล้ว

    Thanks for the video. You helped me. ;)

  • @vupni
    @vupni ปีที่แล้ว

    for some reason when i try to run it (im not in the movement part) it doesnt spawn the piece

  • @jordanthebestlass8483
    @jordanthebestlass8483 2 ปีที่แล้ว +4

    I'm kinda sad you didn't show how to write the data script. I really wanted to know how it works. Dang.

    • @dhruvbadaya3076
      @dhruvbadaya3076 2 ปีที่แล้ว +2

      same here... i need to know how it works. if you find any resource regarding the same, please tell

    • @jordanthebestlass8483
      @jordanthebestlass8483 2 ปีที่แล้ว

      @@dhruvbadaya3076 kinda sad that a lot of tutorial makers do this kinda thing.

    • @jjeastside
      @jjeastside 11 หลายเดือนก่อน

      @jordanthebestlass8483 @dhruvbadaya3076 The data scripts are essentially just different x and y positions that a piece moves to when its being rotated. Think of the it as the rules for the where a piece can rotate to when its a certain rotation state. There are 4 different rotation states a piece can have and it always starts in rotation state 0. When a piece is rotated its checks what types of rotations it can make by referencing the data script. If all of the rotations fail then it fails to rotate. If it is successful then it rotates and its rotation state is updated. If you want an in depth description you check out SRS on the hard drop wiki or look up SRS on youtube.

  • @KIRAH_4E
    @KIRAH_4E 2 ปีที่แล้ว +1

    Hi. I like your work and this tutorial ❤️.. I got a Problem... : Null reference exception object reference not set to an instance of an object piece.Update()??? What I did wrong? Can anyone help me?

    • @billionhrsq
      @billionhrsq 2 ปีที่แล้ว +1

      did you figure it out? im having the same issue

    • @KIRAH_4E
      @KIRAH_4E 2 ปีที่แล้ว

      @@billionhrsq yes I did it was... I wrote one of the letters small. Where did you have a problem in witch line

    • @billionhrsq
      @billionhrsq 2 ปีที่แล้ว +1

      @@KIRAH_4E i accidentally added a new script to the board, deleted the script from the project, and that somehow that missing thing caused this problem.. im not sure how

    • @AGC3424
      @AGC3424 ปีที่แล้ว

      İ have the error
      NullReferenceException: Object reference not set to an instance of an object
      Board.Spawn Piece () (at Assets/Scripts/Board.cs:41
      can someone help me please

    • @KIRAH_4E
      @KIRAH_4E ปีที่แล้ว

      @@AGC3424 I download the script from his zip file and it's work you can Then you can see the mistakes that happened to you....

  • @didaccid5585
    @didaccid5585 3 ปีที่แล้ว +1

    Thank You!!! This is Awesomee!!
    It would be incredible if you teach us how to do flappy birdd!

  • @instantlydrop5364
    @instantlydrop5364 2 ปีที่แล้ว

    17:25min
    start the script In Visual Studio

  • @louisng114
    @louisng114 ปีที่แล้ว +1

    Is 192 pixels per unit optimal for something (resolution reasons, etc) or is it just how big the tiles were drawn as?

  • @pro100tut2
    @pro100tut2 9 หลายเดือนก่อน

    Hi, a very cool lesson, thank you) But I have a problem with turning when the shape is next to the shape. That is, she turns despite the fact that there is another figure standing there

  • @araeswhiteflag
    @araeswhiteflag 3 ปีที่แล้ว +1

    an enum is like....*proceeds to then just describe enums* LOL

  • @JerkyTreats
    @JerkyTreats 2 ปีที่แล้ว +1

    This was great. I personally made the ghost drop logic similar to the lineclear logic- we have access to Board, so we get board.bounds for free. Then just loop from bottom row up until IsValidPosition returns.

    • @incapable_tortoise3703
      @incapable_tortoise3703 ปีที่แล้ว

      the IsValidPosition doesn't check what blocks are above it, so your suggestion wouldn't work as it would incorrectly declare a space valid, when it is blocked by tiles above.

  • @keremtuyluce2807
    @keremtuyluce2807 3 ปีที่แล้ว +1

    @Zigurous NullReferenceException: Object reference not set to an instance of an object
    Board.SpawnPiece () (at Assets/Scripts/Board.cs:41)
    Board.Start () (at Assets/Scripts/Board.cs:33)
    I got this error what is the solution?

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +1

      This error indicates you have not assigned the value of something, thus it is null. If your code matches up exactly to mine, then it would indicate the "activePiece" variable is not assigned. This means you either did not set the activePiece in the Awake function, or maybe you forgot to add that component to the game object in the editor.

    • @keremtuyluce2807
      @keremtuyluce2807 3 ปีที่แล้ว

      @@Zigurous I wanted to add additional shapes to the game and I got this error can you help me solve it

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว

      @@keremtuyluce2807 You are getting an error on line 41 of your Board script. Can you post the function that line of code exists within so I can better understand what might be causing the error.

    • @keremtuyluce2807
      @keremtuyluce2807 3 ปีที่แล้ว

      @@Zigurous I solved the error I got but another error came

    • @keremtuyluce2807
      @keremtuyluce2807 3 ปีที่แล้ว

      @@Zigurous IndexOutOfRangeException: Index was outside the bounds of the array.
      Board.SpawnPiece () (at Assets/Scripts/Board.cs:38)
      Board.Start () (at Assets/Scripts/Board.cs:32)

  • @StygianStyle
    @StygianStyle 3 ปีที่แล้ว +1

    If I wanted to make a lemonade tycoon style game, would I just use Unity, or would I want to use something like WPF for the UI?

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +2

      Most games build the UI within the engine, Unity in this case. Unity has an entire UI system for building interfaces. It might not be the best system if you are an experience UI developer, but it would probably be harder to build and integrate it outside the engine.

    • @StygianStyle
      @StygianStyle 3 ปีที่แล้ว +1

      @@Zigurous Great. Thanks for the reply.

  • @gadgetboyplaysmc
    @gadgetboyplaysmc 3 ปีที่แล้ว +3

    Hey man. How did you learn to make games? I've been trying to code games for 4 years but I can't seem to just be good and confident at writing C# scripts and separating them efficiently. Even this simple game is confusing me. :(. Did you have a tough time as well when you started?

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +2

      It's definitely tough and takes a lot of practice. Like most things, if you keep doing it more and more you will get better and better, just takes time. I was lucky that my high school offered a programming class that introduced me to writing code.
      Keep watching tutorials, perhaps tutorials that are strictly programming not necessarily game dev. Brackey's has a playlist for beginners th-cam.com/play/PLPV2KyIb3jR4CtEelGPsmPzlvP7ISPYzR.html

    • @DidIJustDoThat
      @DidIJustDoThat 2 ปีที่แล้ว

      @@Zigurous I am so happy that clicked in the link😁😁, I am new to programming and I am just kid which wants to create minecraft because it costs money😄😄

  • @ginocarlo7724
    @ginocarlo7724 ปีที่แล้ว

    THIS WAS AWESOME!!

  • @VivaanTheCraft3r
    @VivaanTheCraft3r 3 ปีที่แล้ว +1

    thanks you just earned a massive sub and like and share :)

  • @chrisandrews7945
    @chrisandrews7945 11 หลายเดือนก่อน

    so i get no errors on the ghost script , but for some reason the ghost tile appers one slot outside the bottom on the baord, and if i stack them or if the pieces touch they disaperas, help

  • @theblackdragon7321
    @theblackdragon7321 2 ปีที่แล้ว

    Could you do a custom grid? I have an idea for my indi version. Thanks for posting this

  • @yusufahmed3072
    @yusufahmed3072 3 ปีที่แล้ว +5

    I would love if you made a dig dug remake at some point,it's a bigger project than your usual videos, but will be a great project to work on.

  • @WetrixTech
    @WetrixTech 4 หลายเดือนก่อน

    Does someone know how to move blocks using buttons (or any other UI)?
    I tried to make this game for mobile too but when i want to move piece by clicking on UI, it just wont move because it returns valid = false.
    I have no idea what to do, i tried buttons, script that detect clicks on left & right side of panel and also detecting clicks on left or right side of screen witch was the only option that worked but that doesnt give me as much options as UI that as I need. Anything could help, even 3 years afer releasing this video...
    Reason that i need to detect click on left and right side of UI and not screen is that i can resize UI anytime.
    THANKS! ; )

  • @jakewolf079
    @jakewolf079 ปีที่แล้ว

    1:46:45 Same, I'm failing to type anything all at by this point of the video. In fact the music made me feel like I'm about to die.

  • @aprimic
    @aprimic 2 ปีที่แล้ว

    why have new values for when it might potentially go through a wall? why not instead just use the same values, but scoot them over programmatically?

  • @PhamAnhKhoa118
    @PhamAnhKhoa118 2 ปีที่แล้ว

    Can anyone please explain to me how to make that WallKicksI array? Thank you you guys!!!

    • @jjeastside
      @jjeastside 11 หลายเดือนก่อน

      The wallkicks array is essentially the SRS rotation which tells a piece where it can move. The parameters for the wall kicks array are the changes in vertical position and change in horizonal position. There are 4 checks that need to be made so there are 4 arrays per pieces.

  • @enesemreislek4264
    @enesemreislek4264 2 ปีที่แล้ว +1

    that was really good ty for tutorial .
    if you want the blocks to fall faster instead of falling directly you can do
    if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
    {
    StepDelay /= 10;
    Move(Vector2Int.down);
    }
    else if(Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.DownArrow))
    {
    StepDelay *= 10;
    }

  • @yct6956
    @yct6956 10 หลายเดือนก่อน

    unity read key is unsable,
    sometimes i pressed, there is no reaction
    sometimes i pressed once, the block moves 2 step
    is that only my computer problem?
    thx

  • @1658Tonmoy
    @1658Tonmoy ปีที่แล้ว

    Hello dear how can i add score and game over and restart option in tetris project

  • @r3l1k52
    @r3l1k52 2 ปีที่แล้ว

    Thi shas been a great tutorial, i do have a few other questions becuase ive been having trouble with it, how do i add a sound effect when the line clear activates?

    • @Zigurous
      @Zigurous  2 ปีที่แล้ว

      You'd have to add an AudioSource component to your game object. You can assign an AudioClip asset to that component for whichever sound you want to play, then you would get a reference to the AudioSource component in your script, and finally call the function Play() on it: docs.unity3d.com/ScriptReference/AudioSource.Play.html

  • @DalunBitrus
    @DalunBitrus ปีที่แล้ว

    hello, please after following the tutorial, my spawnpiece are not showing on the board and its not throwing error...please i dont know if someone can help me

  • @adambaldin2462
    @adambaldin2462 ปีที่แล้ว

    Around the 40 min mark I'm getting an error CS1501. It looks like it's because line 31 calls this.activePiece with 3 arguments, but it has none in line 14. I think I have everything typed the same as the tutorial, and I can't figure out what's wrong

    • @adambaldin2462
      @adambaldin2462 ปีที่แล้ว

      Found it. I was missing a bit in the piece script that was ruining the board script.

  • @DillanWilding
    @DillanWilding 2 ปีที่แล้ว

    Anyone know why when I try to do something similar 1 pixel to the right and left of the grid image is being cut off?

  • @ClintonSymington
    @ClintonSymington ปีที่แล้ว

    Hey, Greate Tutorial. One thing I will like to know is. How can I show the next piece that is going to be placed
    on the board?

    • @ClintonSymington
      @ClintonSymington ปีที่แล้ว

      Any Suggestion?

    • @jjeastside
      @jjeastside 11 หลายเดือนก่อน +1

      @@ClintonSymington hey Clinton in order to sohw what the nex piece is going to be you'll need to generate what the next piece is going to be and store it some where. In order to show what it's going to be you'll need a prefab or another tilemap to display it.

  • @asifameerr
    @asifameerr ปีที่แล้ว

    @41 I am getting null reference exception, I dk why?

  • @ryszjak
    @ryszjak 3 ปีที่แล้ว

    Having an issue with the rotate. Seems to create a pieces not in the dictionary with every rotation. Some times it settles on a particular pattern. I've gone over the rotation portion of the video several times, but still haven't nailed down the issue. My rotation matrix looks fine as well.

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +1

      It's hard to say what the issue is. If you are able to post or link your code I can maybe take a look and try to identify the problem.

    • @ryszjak
      @ryszjak 3 ปีที่แล้ว

      @@Zigurous I put up a zip file on github under /caffeinerded/tetris. The rotation works for I and O so I'm looking at the default case in the switch. Thank you for the great content and your help.

    • @ryszjak
      @ryszjak 3 ปีที่แล้ว +1

      @@Zigurous I fixed it. Sorry if I wasted your time. I made the mistake of changing the RoundToInt to CeilToInt in the default case.

  • @jawadulhoq6649
    @jawadulhoq6649 3 ปีที่แล้ว +2

    Can you make a breakout clone? It could be a good tutorial game. (Please include how to change bounce angle of paddle if you do so)

    • @Zigurous
      @Zigurous  3 ปีที่แล้ว +2

      I plan to do Breakout next

    • @krupasanchaniya4191
      @krupasanchaniya4191 2 ปีที่แล้ว

      @@Zigurous i m having an issue at 1:21:36 where the trtris is moving correctly but when i play the game error is showing as index was outside the bounds of array!! what should i do ??

  • @tend18362
    @tend18362 ปีที่แล้ว

    If i try to test the lineclear, unity crashes always? What should I do

  • @sogurejekt1387
    @sogurejekt1387 2 ปีที่แล้ว

    Can I ask why I can not call Move() function outside the script Piece.cs?

    • @jjeastside
      @jjeastside 11 หลายเดือนก่อน

      move () is defined within the pieces.cs script so in order to call it from other scripts you'll need to create an object of the class and call pieces.move()

  • @WilliamMoraes1980
    @WilliamMoraes1980 ปีที่แล้ว

    hello Adam thx to much, for te tutorial, but i would like play this game on my cellphone, how can I chance the comands

  • @asimcan7623
    @asimcan7623 ปีที่แล้ว

    I cant do Total Clear Lines and Points. Please Help me

  • @faust4271
    @faust4271 3 ปีที่แล้ว +1

    Please update hold piece feature please