No video

🎮📱TETRIS Game • Flutter Tutorial from Scratch

  Рет қаралды 30,721

Mitch Koko

Mitch Koko

Күн бұрын

Пікірлер: 144
@createdbykoko
@createdbykoko Жыл бұрын
Tetris Code: mitchkoko.gumroad.com/l/TetrisGameFlutter If you need extra help on the widgets used in this tutorial, check these out: 📱GRIDVIEW • kzfaq.info/get/bejne/pLtygK5ouqu1YYU.html 📱TIMER • kzfaq.info/get/bejne/rM-IrcWL2MrKZYU.html 📱CONTAINER • kzfaq.info/get/bejne/jppnraxyrK-ufnk.html or.. i have an entire widget of the day playlist as well: 📱kzfaq.info/get/bejne/jppnraxyrK-ufnk.html I hope this helps you! happy coding ✌🏾
@maran.ath4
@maran.ath4 Жыл бұрын
You're the next level, you're my goal, I already got to a high level as a flutter Dev and I was beginning to relax, but your videos just 🤯...You're mental Mitch
@createdbykoko
@createdbykoko Жыл бұрын
hahaha you are too nice thank u 💜💜
@nurullahozatak
@nurullahozatak Жыл бұрын
bool checkCollision(Direction direction) { // loop through all direction index for (int i = 0; i < currentPiece.position.length; i++) { // calculate the index of the current piece int row = (currentPiece.position[i] / rowLength).floor(); int col = (currentPiece.position[i] % rowLength); // directions if (direction == Direction.down) { row++; } else if (direction == Direction.right) { col++; } else if (direction == Direction.left) { col--; } // check for collisions with boundaries if (col < 0 || col >= rowLength || row >= columnLength) { return true; } // check for collisions with other landed pieces if (row >= 0 && gameBoard[row][col] != null) { return true; } } // if there is no collision return false return false; }You can update checkCollision to fix collision with other piece
@hakor_
@hakor_ Жыл бұрын
Thank you, I am still confused how the worked for him, without this line.
@maexle14
@maexle14 5 ай бұрын
Thank you very much, you safed my day!
@mrngasa3415
@mrngasa3415 2 ай бұрын
thanks
@lovejeetsingh6506
@lovejeetsingh6506 22 күн бұрын
thanks buddy you save my day❤
@toup5ive
@toup5ive Жыл бұрын
Hey Mitch. Great content. I hope you read this message. Lot of your viewers(beginners) face this problem. All of pieces are not landing on top of each other. We need it to be solved.
@Gooonz
@Gooonz 5 ай бұрын
It was probably cut or not shown during the editing, Add the following inside 'checkCollision' below the checking of the out of bounds: ------------------------------------------------------------------------------------------------------------------------------------------ //Check if the current position is already occupied by another piece in the game board if (row >= 0 && col >=0) { if (gameBoard[row][col] != null) { return true; } } ------------------------------------------------------------------------------------------------------------------------------------------- the particular code can be seen in the video when paused at frame 20:28
@craigpearson4622
@craigpearson4622 Жыл бұрын
Clever👏 you’re clever Mitch✅ not just coding….genuinely inspired teaching 👌
@createdbykoko
@createdbykoko Жыл бұрын
Thanks craig hope it helps you ❤😊
@mugiwaranocoder
@mugiwaranocoder Жыл бұрын
That's really amazing🔥 Good work🎉
@createdbykoko
@createdbykoko Жыл бұрын
Thanks 💜 how’s flutter going for u?
@mugiwaranocoder
@mugiwaranocoder Жыл бұрын
@@createdbykoko Flutter is a really great framework and super fun to code with😄. I'm trying to build different types of project to get better💫. Right now, I'm trying to learn BLoC pattern in order to implement it in my future apps. That would be really interesting if you made a video about BLoC💯
@davekho2000
@davekho2000 Жыл бұрын
Very nice. I really enjoyed this tutorial. Beginner Flutter programmer here (but relatively experienced in scripting). One small problem in the tutorial though. At 19:32, your blocks are stacking, but the checkCollision method you outlined in 15:54 didn't have any code to detect collisions with other pieces. In between, you didn't mention any update to this method. Thankfully, due to your excellent explanation of your code, I figured out what I needed to add to achieve this.
@createdbykoko
@createdbykoko Жыл бұрын
That is amazing to hear! I didn't realise I made an error sorry about that. You should really proud of yourself for being able to figure it out yourself haha. Amazing Dave!! Good luck for your Flutter journey 💜
@kunalkarmawat6370
@kunalkarmawat6370 Жыл бұрын
bro can you give me solution of collision detection
@davekho2000
@davekho2000 Жыл бұрын
@@kunalkarmawat6370 I'll give you a clue. The checkCollision method grabs the positions of the current piece and temporarily moves it into a direction specified. All you need to do is check that the new positions don't clash with any piece on the rest of the board. Luckily, there's a data structure that tracks every position on the board, and whether there's a landed piece in that position. Use that to check to see if all your current piece's new positions are clear (null). I'll leave it to you to figure that out. Oh, when you do your check, also make sure that the current row position is > 0. Dart kicks up a stink if an array/list index is negative, and new pieces can start with a negative value for their positions.
@kunalkarmawat6370
@kunalkarmawat6370 Жыл бұрын
@@davekho2000 bro one more issue happening with me pieces are stop after couple of time
@TranSy-sz2ps
@TranSy-sz2ps Жыл бұрын
I got the same problem at 19:32 :D
@Esy1ification
@Esy1ification Жыл бұрын
I am very impressed with the details, i was already thrilled, but when you added the rotation i wanted to go and pop the fireworks, thats how happy i am. I want one day to reach your level of sofistication.
@createdbykoko
@createdbykoko Жыл бұрын
Haha glad you like it Ester! It makes me happy that it helps you. How is Flutter going so far??💜
@Esy1ification
@Esy1ification Жыл бұрын
@@createdbykoko i am doing great, i wish this was my first programming language i learned in school. My first programming languages was c/c++ in first year university in 2009, and at the time there was limited places one would learn from like KZfaq, so it was more like relying on the materials taught at university, so that made it difficult even more. So just pushed myself to pass the course. So i now want to focus on app and game creation. So i use kotlin/android studio and now trying flutter as well. So far so good.
@johnrm9
@johnrm9 Жыл бұрын
Great video! I found out that instead of using a Map to get the piece (Tetromino) color, using the enhanced enum as in: enum Tetromino { L(Colors.orange), J(Colors.blue), I(Colors.pink), O(Colors.yellow), S(Colors.green), Z(Colors.red), T(Colors.purple); const Tetromino(this.color); final Color color; } then we just get the current piece color using currentPiece.type.color.
@denn319
@denn319 Жыл бұрын
Thanks a lot, Mitch. You inspire me a lot.
@createdbykoko
@createdbykoko Жыл бұрын
haha my pleasure :D
@ChristianKyony
@ChristianKyony Жыл бұрын
This was a short n sweet tutorial. I learned a lot.
@tarunnayak9197
@tarunnayak9197 Жыл бұрын
I don't know why but I am in love🤩 with your Channel content. Great Content as always 💯💯
@createdbykoko
@createdbykoko Жыл бұрын
Thanks Tarun 💜 how’s Flutter going for u??
@tarunnayak9197
@tarunnayak9197 Жыл бұрын
@@createdbykoko Flutter is emotion 🔥, I find Flutter simple & easy and see Flutter as most demanding 📈 in upcoming years, whether it be state management or UI design. These days , I'm just looking forward to learn API fetch in Flutter 😉
@kyawnai
@kyawnai 4 ай бұрын
May I respectfully request you to make a tutorial video for Flutter Flame Game. I am really excited for your tutorial.
@createdbykoko
@createdbykoko 4 ай бұрын
Ok
@fadhilivunza
@fadhilivunza Жыл бұрын
Awesome tutorial, keep up the good work!!!!
@crazy-man
@crazy-man Жыл бұрын
that's cool, only with flame it seems to me it would be much less code without the need to count collisions ,
@christianmuntean
@christianmuntean Жыл бұрын
Best in class 💜
@createdbykoko
@createdbykoko Жыл бұрын
Thanks christian 💜 hows flutter going for u??
@christianmuntean
@christianmuntean Жыл бұрын
@@createdbykoko Great actually. Building my own RegEx File Format for Musical Notation and Sheet Management. Got pretty inspired from your designs and talks
@mohammadtubeshat8700
@mohammadtubeshat8700 Жыл бұрын
You work great and amazin in flutter continue I support you 🎉
@createdbykoko
@createdbykoko Жыл бұрын
thanks mohammad 💜 how is flutter going for u?
@mrngasa3415
@mrngasa3415 2 ай бұрын
great sir
@tommylee6670
@tommylee6670 Жыл бұрын
great tutorial 😄
@createdbykoko
@createdbykoko Жыл бұрын
💜 glad u like it!
@poya.3
@poya.3 Жыл бұрын
Great as always
@createdbykoko
@createdbykoko Жыл бұрын
Thank u! How’s flutter going for u?? 💜💜
@asher4312
@asher4312 Жыл бұрын
You are next level mann🙌🏻🙌🏻❤
@AbdulBasit-sc1gy
@AbdulBasit-sc1gy Жыл бұрын
19:46 My pieces are not stacking on top of each other like this and all are landing at the bottom and then overlapping. Any idea what I might have missed?
@kkamihwang1915
@kkamihwang1915 Жыл бұрын
same, if you fixed it please help me
@deekayo7600
@deekayo7600 Жыл бұрын
I had the same issue just add an else if (col > 0 && row > 0 && gameBoard[row][col] != null) and return true in the checkCollision method.
@filipelauren
@filipelauren Жыл бұрын
@@deekayo7600 I love you
@arjun_kre
@arjun_kre Жыл бұрын
@deekayo7600 OMG!!! it worked thank you so much
@TranSy-sz2ps
@TranSy-sz2ps Жыл бұрын
​@@deekayo7600 It doesn't work in my case, can you give me more explain, bro.
@philosophia5577
@philosophia5577 Жыл бұрын
Yes, we need more help in the business logic part like implementing Collision detection system, movement and rotation. I understand whats going on, but I cant generalise the logic and implement in other projects, that seems pretty hard to get. Maybe some video just about the business logic involved in games would be wonderful!
@hulk8254
@hulk8254 Жыл бұрын
Loved the video. THANKS💜
@taliscodehub404
@taliscodehub404 Жыл бұрын
This is really cool ❤thanks so much bro
@sammyjokes9613
@sammyjokes9613 Жыл бұрын
Great work Mitch!! .. Please Mitch, can you make a video on how to connect flutter project to unity? 🙏
@laminediarra959
@laminediarra959 Жыл бұрын
just beautiful👌
@user-tw6rx6bz2d
@user-tw6rx6bz2d Жыл бұрын
good job . thank you brother
@asifulahsan
@asifulahsan Жыл бұрын
Def. Going to try this one, thanks 👍
@createdbykoko
@createdbykoko Жыл бұрын
try it! and let me know how it goes 💜
@asifulahsan
@asifulahsan Жыл бұрын
@@createdbykoko Will do 👌
@HUNGTRAN-yj2yq
@HUNGTRAN-yj2yq Жыл бұрын
you're awesome
@alaakatlan3543
@alaakatlan3543 Жыл бұрын
Thanks 🎉 That's great 😍 please can you make tutorial about coloring game and drag-and-drop game
@vijaybalajin4096
@vijaybalajin4096 5 ай бұрын
i wonderful u r teaching is so nice .
@user-kw4kp7eq9m
@user-kw4kp7eq9m Жыл бұрын
Good job!
@createdbykoko
@createdbykoko Жыл бұрын
💜
@insensibility
@insensibility Жыл бұрын
Hi, Mitch! Can you make a video on how you set up your Flutter environment? Can you make one for Windows? And if not, what emulator are you using? Thanks for this wonderful video!
@phoenix155
@phoenix155 11 ай бұрын
Thank you so much❤...
@martinpicard850
@martinpicard850 27 күн бұрын
💜
@createdbykoko
@createdbykoko 16 күн бұрын
💜💜💜💜💜 Did you make the tetris successfuly?
@mr.phirun7920
@mr.phirun7920 Жыл бұрын
Great Job Thanks
@mrferrangi2515
@mrferrangi2515 Жыл бұрын
thanks
@AbbasAlhashme
@AbbasAlhashme Жыл бұрын
❤🔥😍❤️ well done ❤️
@codingmonk-flutter1452
@codingmonk-flutter1452 Жыл бұрын
💜💜💜💜💜
@user-pv8gm3sv8b
@user-pv8gm3sv8b Жыл бұрын
This Tetris tutorial was really great :D. I am kinda beginner.. so I tried to copy the exact same code as mentioned in the video, but still my every tetromino is landing on the bottom only, instead of landing on top of the below tetromino block. :(. Can anyone help please?
@wojtkozprzeworska9044
@wojtkozprzeworska9044 Жыл бұрын
In checkCollision method you should add if (row >= 0 && col >= 0 && gameBoard[row][col] != null) { return true; }
@zakariahouache5442
@zakariahouache5442 Жыл бұрын
where are you absent You don't upload many videos anymore. We missed your new ideas, so design and programming🎉🎉🎉
@dhruvjohari8759
@dhruvjohari8759 Ай бұрын
Hi, their is one problem that's if we completely fill the last row as end row then after that we just skip 2-3 lines and then make the row fill then it just show error , how can I solve that .
@philosophia5577
@philosophia5577 Жыл бұрын
The tetrominos stop falling after couple of times, can anyone help?? I am stuck at it for 4 hours...
@createdbykoko
@createdbykoko Жыл бұрын
Yeah i can help! But i’ll need more information. So just after 2 pieces land and no 3rd one??
@philosophia5577
@philosophia5577 Жыл бұрын
@@createdbykoko Exactly. But it generally happens after 6-7 pieces have fallen. I have checked all the methods multuiple times and not able to get this through. Let me know if you need to see the code, I will share the github link.
@kunalkarmawat6370
@kunalkarmawat6370 Жыл бұрын
​@@philosophia5577 you are correct bro its really happening with me also
@kunalkarmawat6370
@kunalkarmawat6370 Жыл бұрын
​@@philosophia5577 if you get an answer share with me please 😞
@harshitkaushal9766
@harshitkaushal9766 Жыл бұрын
error has been solved??
@cabdraxmaanguuled9152
@cabdraxmaanguuled9152 16 күн бұрын
Bro i do but i have problem for loop is not stop when chackland void what is solution
@obaidkhan3971
@obaidkhan3971 Жыл бұрын
any video about horizontal bar chart?
@imshavlog
@imshavlog Жыл бұрын
Hey can you show how to install and begin?
@divyanshvashist6970
@divyanshvashist6970 Жыл бұрын
Hey mitch can u check why the pieces are not dropping after sometime cause its occuring randomly
@Maxsuel_Novais
@Maxsuel_Novais Жыл бұрын
make a video developing an application like 99 Taxi and creating API and Database without Google's Firebase
@kenzy-rwb
@kenzy-rwb Жыл бұрын
I tried to add code in createNewPiece but it’s still stuck in checkLeading how to fix bro
@createdbykoko
@createdbykoko Жыл бұрын
give me more info about the error
@philosophia5577
@philosophia5577 Жыл бұрын
@@createdbykoko the code stops generating new piece after a few pieces randomly.
@valkiprasannakumar2387
@valkiprasannakumar2387 Жыл бұрын
I lost hope in learning flutter😭but i will watch your videos 🎉
@createdbykoko
@createdbykoko Жыл бұрын
why did you lose hope :( what happened!?
@valkiprasannakumar2387
@valkiprasannakumar2387 Жыл бұрын
I am working on Agora video call package but i making me sick. i just quit😭
@mracipayam
@mracipayam Жыл бұрын
@@valkiprasannakumar2387 Try another package, it is meaningless you quit because of a 3rd party package.
@hearvie
@hearvie Жыл бұрын
​@@valkiprasannakumar2387 working with videos generally is a pain in the ass with flutter. Most people just avoid it.
@blesfemy
@blesfemy 6 ай бұрын
My blocks for some reason going through each other. Checked code and it looks identical, do you have any idea what might be wrong?
@MCprobably
@MCprobably Ай бұрын
Has anybody solved the Range Error? when a line is full in the middle of the game board this Range Error shows up
@Rigobert99
@Rigobert99 Жыл бұрын
Another one
@createdbykoko
@createdbykoko Жыл бұрын
💜
@mohammadumair8951
@mohammadumair8951 11 ай бұрын
My game is not running properly. When I play the game, the pieces stop in the first row and the game ends automatically. Another problem is that when the pieces fall on top of each other, the missing first piece is overwritten. Someone help me
@AbdulBasit-sc1gy
@AbdulBasit-sc1gy Жыл бұрын
Hey Mitch! Great Content as usual. Everything works fine but I am getting RangeError when a line is cleared from the middle of the screen. Any idea why this might be happening?
@wojtkozprzeworska9044
@wojtkozprzeworska9044 Жыл бұрын
I found an issue in clearLines method. In line with "gameBoard[0] = List.generate(row, (index) => null);" change the "row" to "rowLength"
@programmercherry
@programmercherry 10 ай бұрын
Hi, the rotation isn’t working for me. I tried everything you said and I can’t seem to find the problem. Can you please help me?
@Siddhant2003Bisht
@Siddhant2003Bisht 8 ай бұрын
try changing the rotationState value to 1 instead of -1
@harshitkaushal9766
@harshitkaushal9766 Жыл бұрын
anyone can shared source code with me, pieces are stop after couple of time, how to solve this error please help me
@manishgautam2424
@manishgautam2424 Жыл бұрын
Superb but do your hard work as open source
@shreeramk0001
@shreeramk0001 Жыл бұрын
31:26 bru im getting range error in line 156 (RangeError (index): Index out of range: index should be less than 10: 14) can you help me boss?? thanks a lot
@Siddhant2003Bisht
@Siddhant2003Bisht 8 ай бұрын
you can try this code void clearLines() { int linesCleared = 0; for (int row = colLen - 1; row >= 0; row--) { bool rowIsFull = true; for (int col = 0; col < rowLen; col++) { if (gameBoard[row][col] == null) { rowIsFull = false; break; } } if (rowIsFull) { for (int r = row; r > 0; r--) { gameBoard[r] = List.from(gameBoard[r - 1]); } gameBoard[0] = List.generate(rowLen, (index) => null); // Update the positions of the falling piece for (int i = 0; i < currentPiece.position.length; i++) { currentPiece.position[i] += rowLen; } linesCleared++; } } if (linesCleared > 0) { // Update score for each cleared line currentScore ++; } }
@Gooonz
@Gooonz 4 ай бұрын
Has anybody solved the Range Error for this? It happens when a line is full in the middle of the gameboard...
@MCprobably
@MCprobably Ай бұрын
I have the same problem did you find the solution for this???
@Gooonz
@Gooonz Ай бұрын
@@MCprobably nope.
@lmgrmjamine2364
@lmgrmjamine2364 Жыл бұрын
can someone help me please , when i rotate the letter Z it doesn't rotate correctly , that's the part of Pieces code i copy it like Mitch: case Tetromino.Z: switch (rotationState) { case 0: newPosition = [ position[0] + rowLength - 2, position[1], position[2] + rowLength - 1, position[3] + 1, ]; //check that the new position is valid if (piecePositionisValid(newPosition)) { //update position position = newPosition; //update rotation state rotationState = (rotationState + 1) % 4; } break; case 1: //assign new position newPosition = [ position[0] - rowLength + 2, position[1], position[2] - rowLength + 1, position[3] - 1, ]; //check that the new position is valid if (piecePositionisValid(newPosition)) { //update position position = newPosition; //update rotation state rotationState = (rotationState + 1) % 4; } break; case 2: newPosition = [ position[0] + rowLength - 2, position[1], position[2] + rowLength - 1, position[3] + 1 ]; //check that the new position is valid if (piecePositionisValid(newPosition)) { //update position position = newPosition; //update rotation state rotationState = (rotationState + 1) % 4; } break; case 3: newPosition = [ position[0] - rowLength + 2, position[1], position[2] - rowLength + 1, position[3] - 1, ]; //check that the new position is valid if (piecePositionisValid(newPosition)) { //update position position = newPosition; //update rotation state rotationState = 0; } break; } break;
@createdbykoko
@createdbykoko Жыл бұрын
It might be because of the starting initial position of Z. What does your code look like for that? It should be near the top of the code
@lmgrmjamine2364
@lmgrmjamine2364 Жыл бұрын
@@createdbykoko well i have done the same as you and the tetromino Z piece start from up top as you did in the video
@secret_412
@secret_412 6 ай бұрын
​@@lmgrmjamine2364 Have you been solving the problem?
@lmgrmjamine2364
@lmgrmjamine2364 6 ай бұрын
@@secret_412 nah , it didn't work at all
@winnidz9832
@winnidz9832 8 күн бұрын
hello, same problem i toke the solution from the comments, it worked , but stoped when [row] is negative so i tried that modification with [row.abs()], if (col < 0 || col >= rowlenght || row >= columnlenght || board[row.abs()][col] != null) { return true; it work for the moment
@Omen_Cypher
@Omen_Cypher Ай бұрын
does any one has the source code
@createdbykoko
@createdbykoko Ай бұрын
@@Omen_Cypher mitchkoko.gumroad.com/l/TetrisGameFlutter
@mrferrangi2515
@mrferrangi2515 Жыл бұрын
🥰🥰🥰🥰🥰🥰🥰
@GrowthPersonal
@GrowthPersonal 3 ай бұрын
@madhank93
@madhank93 Жыл бұрын
Awesome as usual 🎉
@pranaygsk5045
@pranaygsk5045 8 ай бұрын
💜
@mickiee459
@mickiee459 Жыл бұрын
💜
@createdbykoko
@createdbykoko Жыл бұрын
💜💜💜
@aravindhhere
@aravindhhere Жыл бұрын
💜
@tusharmaurya1668
@tusharmaurya1668 Жыл бұрын
💜
@ishanmaddumage
@ishanmaddumage Жыл бұрын
💜
@asher4312
@asher4312 Жыл бұрын
💜💜
@createdbykoko
@createdbykoko Жыл бұрын
Asher!!! 💜 how was it bro
@asher4312
@asher4312 Жыл бұрын
@@createdbykokoAmazing content as always..very informative tutorial and interactive as well as your other videos literally.Thank you very much for this🙌🏻❤️
@arjun_kre
@arjun_kre Жыл бұрын
💜💜
@miximum1
@miximum1 7 ай бұрын
💜
TETRIS • FLUTTER TUTORIAL
15:59
Mitch Koko
Рет қаралды 37 М.
👑📱 Chess • Flutter Game Tutorial
53:21
Mitch Koko
Рет қаралды 24 М.
When you discover a family secret
00:59
im_siowei
Рет қаралды 22 МЛН
wow so cute 🥰
00:20
dednahype
Рет қаралды 31 МЛН
Magic? 😨
00:14
Andrey Grechka
Рет қаралды 20 МЛН
❌Разве такое возможно? #story
01:00
Кэри Найс
Рет қаралды 3,8 МЛН
Why is this game made with Flutter?
17:46
Filip Hráček
Рет қаралды 21 М.
Why I'm not switching to Unreal Engine | Unity vs Unreal
7:08
Sasquatch B Studios
Рет қаралды 75 М.
📱 FULL Food Delivery App w/ Backend • Flutter Tutorial
1:49:00
KMP vs. Flutter - Who Will Win The Cross-Platform Battle?
16:19
Philipp Lackner
Рет қаралды 44 М.
👨🏽‍💻 Let's clone a dribbble design using FLUTTER ♡
38:41
Creating Tetris in Python with pygame - Beginner Tutorial (OOP)
1:59:28
Programming With Nick
Рет қаралды 57 М.
📱 TO DO App • Flutter Tutorial ♥ Hive Local Storage
42:35
Mitch Koko
Рет қаралды 153 М.
Game Development with Flutter & Flame | 2024
7:10
CodeX
Рет қаралды 9 М.
When you discover a family secret
00:59
im_siowei
Рет қаралды 22 МЛН