*Source code* If you don't want to write the code yourself, it's available here for 3$ (and free for Patreon supporters): www.patreon.com/OttoBotCode/shop/78691 Your support would be a massive help for me and my channel! 🤩
@@norbertabone9157 That's a shame. It works just fine on my end. Could you try again and see if it works now? Alternatively, try to go straight to www.patreon.com/OttoBotCode. You can find the Tetris code in the shop 😊
Very good for showing a completed project! Can't say many have ever actually shown a project as finished, or even so much as _declared_ their project as finished. So that gets bonus points! Kudos, bro.
Bro I can't stress this enough : if you keep making C++ , C# tutorials your channel is going to skyrocket ,and hold on hold on before you say that people are more into py and js now yeah yeah I’ve done it all ppl in the comments have done it all, BUT because C# and C++ tutorials are FREAKING rare . I figured that learning the universal concepts and principles of programming languages and their special features are best served with a pinch of tutorials before you go out there and create your own apps. It can be very frustrating just sitting there and creating stuff without seeing how to make them in the first place. You are freaking life savior with this I swear to God. PLEASE make more videos !!!n
Thanks, I hear you. There will be more videos, this is just the beginning! At the moment, it's hard for me to find time for my videos, but that will change in 2 months time 😉
@@OttoBotCode For real this is one of the best tutorial video's I've ever seen in my programming career love to see a new big channel at it's early stages of growing! I will do my best to share this content with everyone I know that loves this! I hope the best for you and wishes your channel a great growth in the near future :)
thank you for showing the complete guide from programming to developing and testing everything in real world. it helps me a lot to understand the various use of method and functions too ..keep it up.. one subscriber ..
I'm a beginner at C# and unfortunately this is very hard for me to follow for some reason. Something about the explanations don't "click" with me. Maybe I'll try it again at a future time. Appreciate all the hard work you put in it though and the fact that you answer all your comments. Much respect.
For a beginner, this is too hard. It's more helpful for people who know properties, inheritance, basic collections, etc. If you know such things, following a tutorial like this one can help you get to the next level. I don't speed up the typing like I did for this video anymore, that's probably another reason why it's a bit hard to follow. Once you get more familiar with C# and you want to create a small project, definetely come back here (or perhaps check out my Snake tutorial) and give that a try. Thanks for your comment! 😊
Otto, this tutorial helped me a lot. Thank you for a clear and simple explanation. Keep making such amazing and interesting videos. Well done and good luck
Master... thank you very much for the quality of your content. It is a great contribution to make the knowledge available to everyone. Someday i want to be like you.
Thanks for making this video. I believe it is the best way to learn how to transform theory into true code. You have been very clear and I would not be able to do many things.
This is one of the best programming videos I've seen. Everything very well explained but simple at same time. Btw loved the edit too. Keep up the amazing work! Thank youu!!
Well, I'm still in the 'learning to code phase' but I just finished my first iteration of Tetris which I coded with JavaScript. Wow, at a certain point I thought I was going to lose my mind because I ran into so many issues, but somehow it's 95% finished now. So, seeing your vid thumbnail, I thought I'd come and learn something. My code is about 4 times the size of yours. I've got a thing or two to learn as yet. It's fascinating to see how you handled the dropping of non-full rows after clearing 'x' amount of rows. That whole process gave me massive headaches.
This is amazing. How did you learn to program, so simple yet so efficiently? It's like you are so perfect at this, when I program I just go with the flow, and although I would love my code to be as flexible and simple as yours, it never turns out like this. You are extremely talented, thanks for this amazing tutorial.
Thank you so much for the kind words! When I program, I try my best to write clean and efficient code that's as easy to understand as possible. I have a masters degree in computer science, which is where I have a lot of my knowledge from. My coding style comes from a lot of hard work and passion for the field! 😊
This tutorial is great, but for some reason I couldn't get the game to run fully. While debugging, the game goes to GameOver state after a split second. After pressing "PlayAgine" it is the same. VisualStudio shows no errors.
Very cool game, it was fun to make at times, other times it was a pain in the back because of the errors I got, but overall, I got'em fixed and the game itself is pretty well done. Thank you for the experience
'MainWindow' does not contain a definition for 'Window_KeyDown' and no accessible extension method 'Window_KeyDown' accepting a first argument of type 'MainWindow' could be found (are you missing a using directive or an assembly reference?)😣
aw i was hoping you'd do 7-bag instead of random with double protection 7-bag is like, you get the tetrominos in groups, or bags, of 7. all tetrominos in one bag are different. then you get a new bag, and the cycle repeats. 7-bag is the standard in modern guideline Tetris
this game is not fool proof so if you got bad code in some in it then find a new game to code. Otto can you like put comments on top of the code so it makes sense please.
@@OttoBotCode Look at how Brad Traversy does it. I almost never have to pause in his videos. It makes it flow. Here I have to pause my self into madness.
First off fantastic video. Secondly I see there's code so that the same block cannot be called twice in a row. What would be the best way to make this happen call all 7 blocks before repeating the same block?
I have problem here the block it doesn't move. When I press the keys for rotating is ok but when I press right, left and down button it doesn't move please help me 29:07
@@OttoBotCode Is it possible to add tetris song to this app? I know how to do it in Windows Forms app, but here the same code doesn't work :sob: I added the mp3 file to the Assets folder and changed the Build Action to Resource as for the images, but what do I do next? Thank you so much for your assistance. :hugging_face:
@@elenatrifonova5286 For the mp3 file. You have to set "Build Action" to "Content" and "Copy to Output Directory" to "Copy always". You can play the sound with the MediaPlayer class. MediaPlayer player = new MediaPlayer(); player.Open(new Uri("Assets/your_sound.mp3", UriKind.Relative)); player.Play();
Hey i ran into this issue what should i do 'MainWindow' does not contain a definition for 'GameCanvas_Loaded' and no accessible extension method 'GameCanvas_Loaded' accepting a first argument of type 'MainWindow' could be found (are you missing a using directive or an assembly reference?
Hello! I am having some trouble with the game after play again is clicked. The DropBlock method is not being invoked but all the other buttons work. When I do the dropblock method, the game speed up. Any ideas? Thank you!
Thanks for buying the code. You should unzip the compressed file first and then open Tetris.sln with Visual Studio. Once opened, you can start the game by clicking the run button (green arrow) or pressing CTRL + F5. If that does not work, let me know what kind of error message you get! ☺
Hello! What a great video! I haven't made the project yet but have a quick question, I notice that you use individual tile pictures to make a whole block, can I use the entire png of the block instead of using this method? I wish to make my own fun spin on Tetris with a different style to the blocks, maybe something like animals! Thanks!
It is possible but you would have to change the code to display your blocks correctly. Also keep in mind that your blocks will be chopped up when the player clears a row.
Thanks for buying the code. The issue probably has something to do with your Visual Studio setup. What errors do you get? If you prefer, you can also contact me at ottobotcodehelp@gmail.com 😊
Good afternoon! I have a problem in the code. I am writing on Visual stusio 2017. Everything is clearly written in code, but the O-block is not displayed. It is displayed transparent on the playing field, although it is displayed in the HOLD and NEXT fields.
The hold and next fields display the Block-O.png image. On the playing field, an O-block is displayed using four instances of TileYellow.png. I suspect that Tile-Yellow.png is not loaded correctly in your project. Make sure that Tile-Yellow.png has build action set to "Resource" and double check that you have written the filename correctly in MainWindow.xaml.cs. Let me know if this resolves the issue! 😊
I would guess that your Position class is "internal" or "private". Make sure the Position class is "public". Inside Position.cs, the code should be: public class Position 😀
I am glad that it helped you. Many games are easiest to implement using some kind of grid. Unfortunately, I am not familiar with dr.Mario, but best of luck with your project 😀
You don't need to make it public, that's just how I was taught programming. Using "abstract" does make a lot of sense because we don't want the Block class to be instantiated directly (only the subclasses).
It's hard for me to guess what the issue is. The source code for the project is available here for 3$: www.patreon.com/OttoBotCode/shop. If that doesn't help you locate the mistake, then I can take a look at your project 😊
its beutiful how you animate this to show it. i dont know how you do it but it shows us really well. thanks a lot. im gonna make this on my school computer and im making snake at home
I have a question. What should i do if i want to tetris 3d? How should i set the positions and change 'Block' class? I am not sure honestly how many position state.
I hope i get an answer after all the time :D The .Reset(); method at 14:38 is red underlined because its not defined and either am blind or you didn't shown it. What to write in it if i create the method?
Hey, where you learned programming like that? Any Books or only tutorials from yt, maybe some studies(I ask out of curiosity). About same game, this is really simple explain and coding, good work.
Hello! I have a bachelor's degree in "Software Development" and a master's degree in "Computer Science" 😊 Whenever I find something that interests me, I like to try it myself and create some small project 😉 Great that you like this one!
I get an error in IBlock at 11:15. Apparently I'm using an older version which doesn't support the notation "new(0,1)". Do you know of a way I can rewrite this so that it works?
You are right, I have omitted the type after "new" which you can only do in C# 9 or later. For older versions you have to always write the type explicitly like this: new Position(r,c) Hope that helps! 😃
@@OttoBotCodeI kept wanting to reach through the screen and rewrite your code to use the new C#11 collection initializers and then I realized this was 2 years old. 😂 Great video! Subscribed.
I also want to ask about how can you think about what function to create and how would you create it.. for example create a basic function that can be called later inside another function .. how do you think about it? Does this comes from experience and you just instinctively create all the functions in one go? is there a mathematics that can help us create the desired function? Does math function is really important in programming? for example a composite function is that necessary to learn for programming.. i honestly dont know what function to create but you just seamlessly code that without any troubles..
What you don't see in the video is the process of planning everything and structured the code to be as easy to understand as possible. There are design principles and standard patterns you can follow to some extent. That being said, there is no substitute for practice. With time you will develop a feel for what "good" code and "bad" code is. How important is math? That really depends on what you want to do. For most projects it's not so important in my opinion. It's more important to think logically and keep the code as simple as possible. BUT the really impressive programs like ray tracers, machine learning algorithms and game engines require a lot of math! 😉
First, thanks for the tutorial. I have an Issue that is only one tetrominos spawns I can move him around and place but after that they spawn no one more
Sorry I completely missed your comment! The easiest way to add a pause feature would probably be to add a bool isGamePaused to MainWindow.xaml.cs. When the user presses P (or some other key) we set isGamePaused to true if it's currently false and vice versa. You also want to show something on the screen that indicates that the game is paused. When isGamePaused is true, we must make sure that: a) Pressing any key (except P) won't do anything. b) The current block doesn't move down. Stopping the current block from moving down can be a bit tricky, it requires modifying the game loop a bit. The easiest (but maybe not the prettiest) way would be to add a condition like this: if (!isGamePaused) { gameState.MoveBlockDown(); Draw(gameState); } That way each iteration of the game loop doesn't manipulate the GameState when the game is paused. Hope this makes sense and thank you for the kind words 😊
I can't get the keys to work, I can't find anything I haven't followed perfectly as I re watch the video. The only thing that sticks out is I have a "Non-nullable field 'currentBlock' must contain a non-null value when exiting the constructor....." So I'm not sure if that has anything to do with it.
Does nothing happen when you press the arrow keys? Try setting a breakpoint in Window_KeyDown and then run the program in Debug mode. Then let me know if that breakpoint is hit when you press the arrow keys.
@@OttoBotCode tried that. And that is about the extent of my knowledge with debugging using visual studio features. And it did not trigger the breakpoint.
@@chadgessner4412 Okay so it seems like the event handler is not registered. I think the problem is in MainWindow.xaml. Do you have this property "KeyDown="Window_KeyDown" on the Window?
@@OttoBotCode I may have found something useful... My Window_KeyDown shows '0 references' above it, but yours shows 1. Maybe I missed a line of code somewhere?
I'm up to GameStateBlock and I'm a little concerned as I have several underlined code words in this block (like GameState and BlockFits) and others that you do not. I've followed you perfectly down to the exact line number on every block....... I'm using VS 17.9.3 ease my mind please?? thanks
My guess would be that the warnings disappear if you disable the "nullable" feature under project settings. It is a newer feature which is now enabled by default when you create a project. Its purpose is to help you avoid null reference exceptions by imposing additional constraints on your code. I did not follow these constraints. Don't worry about those warnings, the code will work just fine! For this project, I recommend disabling nullable under project settings. That should get rid of those annoying warnings! Best of luck with the tutorial 😊
Hi, project should comply with the following requirements: the application should have a graphic user interface (using WinForms, WPF or similar) all the .NET naming conventions should be followed all the classes, variables, properties etc. should be named with a comprehensible and descriptive name source code should be formated in a well arranged way code shouldn't contain long methods project doesn't contain any "dead code" each method serves only one purpose code is well and purposely commented code doesn't contain old comments code doesn't contain needless comments data and methods working with this data are part of one class all non-constant data fields are declared as private (and made accessible using a method or by encapsulation as a property) inheritance represents the "IS-A" relationship if applicable, the code is meaningfully covered by unit tests all unit tests pass application is divided into layers (presentation layer is separated from the application logic layer) code doesn't contain anti-patterns or smells of code: code doesn't contain "magic constants" code doesn't contain "god objects" code doesn't contain any "error hiding" anti-pattern is this project fitting these requirements best regards
*Source code*
If you don't want to write the code yourself, it's available here for 3$ (and free for Patreon supporters):
www.patreon.com/OttoBotCode/shop/78691
Your support would be a massive help for me and my channel! 🤩
The link seems not to be working
@@norbertabone9157 That's a shame. It works just fine on my end. Could you try again and see if it works now? Alternatively, try to go straight to www.patreon.com/OttoBotCode. You can find the Tetris code in the shop 😊
Brother do you want sail any project of c#
Bcz i need in emergency
@@OttoBotCodeI see CS0122 Error. I don't know how to fix it. Thanks for advance.
Here's the code:
int dropDistance = gameState.BlockDropDistance();
I love how you took the time to talk about designing the application. Much appreciated after browsing other C# videos.
I am glad you liked it, thanks for watching!
I love how simple this way of creating Tetris is compared to other examples. Keep up the good work!
Thanks, I appreciate it. More content coming soon😀
@@OttoBotCode What is the name of the data structure u used?
Very good for showing a completed project! Can't say many have ever actually shown a project as finished, or even so much as _declared_ their project as finished. So that gets bonus points! Kudos, bro.
Bro I can't stress this enough : if you keep making C++ , C# tutorials your channel is going to skyrocket ,and hold on hold on before you say that people are more into py and js now yeah yeah I’ve done it all ppl in the comments have done it all, BUT because C# and C++ tutorials are FREAKING rare . I figured that learning the universal concepts and principles of programming languages and their special features are best served with a pinch of tutorials before you go out there and create your own apps. It can be very frustrating just sitting there and creating stuff without seeing how to make them in the first place. You are freaking life savior with this I swear to God. PLEASE make more videos !!!n
Thanks, I hear you. There will be more videos, this is just the beginning!
At the moment, it's hard for me to find time for my videos, but that will change in 2 months time 😉
@@OttoBotCode Man all thanks to you sure I can't wait to see more !
I'm from Belarus, studying at university and starting to make games. Your tutorial was very helpful, the code is very beautiful. Thank you ♥♥♥
Thank you! I'm glad you like it 👍
this video and channel are SOOO underrated you deserved my sub!
Thank you so much!
@@OttoBotCode For real this is one of the best tutorial video's I've ever seen in my programming career love to see a new big channel at it's early stages of growing! I will do my best to share this content with everyone I know that loves this!
I hope the best for you and wishes your channel a great growth in the near future :)
@@TeamROsky Awesome to hear. It is greatly appreciated, much more content coming soon!
@@OttoBotCode My teacher has send the other classes towards your video so they can do this as a task! Never expected that to happen but here you go :)
@@TeamROsky Wow super cool! Thanks again :)
thank you for showing the complete guide from programming to developing and testing everything in real world.
it helps me a lot to understand the various use of method and functions too ..keep it up..
one subscriber ..
I'm a beginner at C# and unfortunately this is very hard for me to follow for some reason. Something about the explanations don't "click" with me. Maybe I'll try it again at a future time. Appreciate all the hard work you put in it though and the fact that you answer all your comments. Much respect.
For a beginner, this is too hard. It's more helpful for people who know properties, inheritance, basic collections, etc. If you know such things, following a tutorial like this one can help you get to the next level. I don't speed up the typing like I did for this video anymore, that's probably another reason why it's a bit hard to follow.
Once you get more familiar with C# and you want to create a small project, definetely come back here (or perhaps check out my Snake tutorial) and give that a try.
Thanks for your comment! 😊
the implementation is more math than code, hes good at explaining what each method does ur just not listening
@@BeenYT He said it himself that this is too hard for beginner. I guess "ur" just not reading...
why is this channel so underrated????
Otto, this tutorial helped me a lot. Thank you for a clear and simple explanation. Keep making such amazing and interesting videos. Well done and good luck
Thank you, that's great to hear! I'm working on the next project (also in C#) 😉
Very clean! Don't know how i stumbled upon this video, but well done :)
This would be my weekend challenge for this Saturday. Thanks for the great tutorial!
Thank you! 😃
Master... thank you very much for the quality of your content. It is a great contribution to make the knowledge available to everyone. Someday i want to be like you.
Glad you enjoyed it and thanks for the kind words!
Thanks for making this video. I believe it is the best way to learn how to transform theory into true code. You have been very clear and I would not be able to do many things.
Thank you for watching. Glad it was helpful
This is one of the best programming videos I've seen. Everything very well explained but simple at same time. Btw loved the edit too. Keep up the amazing work! Thank youu!!
Thank you! Awesome to hear 😃
Seriously well done and thank you for this.
Very good explanations, it helped me a lot in learning object oriented programming in C#. thanks a lot!!! :-)
Thanks for your comment 😊
Thanks mate, this helped me a lot!
Very clear and good explanation, good animations and entertaining, helped me a lot :) Well done:)
Thank you so much, really glad you like it!
So simple and clear! I like it
Also I noticed how your clead code improves mine, and it feels is amazing! Thank you
Great to hear! Thanks for your comment 👍
Great video!! the idea flow is simple and easy to understand
Well, I'm still in the 'learning to code phase' but I just finished my first iteration of Tetris which I coded with JavaScript. Wow, at a certain point I thought I was going to lose my mind because I ran into so many issues, but somehow it's 95% finished now. So, seeing your vid thumbnail, I thought I'd come and learn something. My code is about 4 times the size of yours. I've got a thing or two to learn as yet. It's fascinating to see how you handled the dropping of non-full rows after clearing 'x' amount of rows. That whole process gave me massive headaches.
Good luck with finishing your project. I'm glad this video was helpful 😊
Great tutorial Otto, this is a feature-rich game.
Thanks!
I've seen that has actually explained it to in a concise way!
This is amazing. How did you learn to program, so simple yet so efficiently? It's like you are so perfect at this, when I program I just go with the flow, and although I would love my code to be as flexible and simple as yours, it never turns out like this.
You are extremely talented, thanks for this amazing tutorial.
Thank you so much for the kind words! When I program, I try my best to write clean and efficient code that's as easy to understand as possible. I have a masters degree in computer science, which is where I have a lot of my knowledge from. My coding style comes from a lot of hard work and passion for the field! 😊
Great video. It was easy to follow and understand.
It's my first day of soft School, and I can tell I'm going to like my teacher!
This tutorial is great, but for some reason I couldn't get the game to run fully. While debugging, the game goes to GameOver state after a split second. After pressing "PlayAgine" it is the same. VisualStudio shows no errors.
Very cool game, it was fun to make at times, other times it was a pain in the back because of the errors I got, but overall, I got'em fixed and the game itself is pretty well done.
Thank you for the experience
Glad to hear you worked out in the end. Thanks for your comment!
This is awesome. Thank you so much and greetings from Argentina
Thanks for your comment and greetings from Denmark 😉
'MainWindow' does not contain a definition for 'Window_KeyDown' and no accessible extension method 'Window_KeyDown' accepting a first argument of type 'MainWindow' could be found (are you missing a using directive or an assembly reference?)😣
I'm surprised you have less than 700 subs! This is great content, keep up the great work
Thank you for the kind words. More content coming soon 😊
DUDE, I got so frustrated 'cause of that problem, thanks a lot!
Elsker at jeg kan hører du er dansker!
OMG, it really worked. Thank you so much!!
You're welcome!
Really appreciate it!!!!
aw i was hoping you'd do 7-bag instead of random with double protection
7-bag is like, you get the tetrominos in groups, or bags, of 7. all tetrominos in one bag are different. then you get a new bag, and the cycle repeats. 7-bag is the standard in modern guideline Tetris
also no SRS kick table :(
Seriously impressive - thanks!
You're welcome 😊
thank you so much. Its easy to understand. it was really helpful
You're welcome 😃 Glad you liked it!
27:58 I'm getting 2 errors under the TilePositions and under the Id in [block.Id]. Both the error codes are CS1061
this game is not fool proof so if you got bad code in some in it then find a new game to code. Otto can you like put comments on top of the code so it makes sense please.
couldn't agree more
utilised and enjoyed wNice tutoriallst increasing in value.
what throws off is the step sequencer. i ntally associate it with a soft/clip whether it's being used or not. also when you do
Why do you have to speed up the coding? If you coded in natural speed we could code along with you.
I figured that you would have to pause and play anyway but I appreciate the feedback!
@@OttoBotCode Look at how Brad Traversy does it. I almost never have to pause in his videos. It makes it flow. Here I have to pause my self into madness.
@@jellycoding I will check it out, thanks
Thanks! Good Work!
Thank you 😃
thank you sooo much for the torurial.it helps a lot
You are welcome 😊 Thanks for your comment 👍
nice tuto bro, that solved!
Make a guide about snake game!
I will add it to my list 👍
It took a while but I did it! 😁
ruclips.net/video/uzAXxFBbVoE/видео.html
First off fantastic video.
Secondly I see there's code so that the same block cannot be called twice in a row.
What would be the best way to make this happen call all 7 blocks before repeating the same block?
Great vid!
Thanks! 😉
I have problem here the block it doesn't move. When I press the keys for rotating is ok but when I press right, left and down button it doesn't move please help me 29:07
Great video 👍🥰❤️
It's awesome!!! Thank you very, very much!!!!
Thanks for the nice comment 😊
OMG! You are a life saver. Thanks you for clear description of every step of the way; amazing content! Good luck!!!!
You're welcome 😀
@@OttoBotCode Is it possible to add tetris song to this app? I know how to do it in Windows Forms app, but here the same code doesn't work :sob: I added the mp3 file to the Assets folder and changed the Build Action to Resource as for the images, but what do I do next? Thank you so much for your assistance. :hugging_face:
@@elenatrifonova5286 For the mp3 file. You have to set "Build Action" to "Content" and "Copy to Output Directory" to "Copy always".
You can play the sound with the MediaPlayer class.
MediaPlayer player = new MediaPlayer();
player.Open(new Uri("Assets/your_sound.mp3", UriKind.Relative));
player.Play();
@@OttoBotCode Super Mega LIKE to you, my friend! It can sing now :grin:
Hey i ran into this issue what should i do 'MainWindow' does not contain a definition for 'GameCanvas_Loaded' and no accessible extension method 'GameCanvas_Loaded' accepting a first argument of type 'MainWindow' could be found (are you missing a using directive or an assembly reference?
Hello! It sounds like you are missing the GameCanvas_Loaded method in MainWindow.xaml.cs.
@@OttoBotCode true I fixed it but the program was just showing the canvas but it was still empty how do I fix that?
this was so good and simple !!
Thanks and happy new year 😀
Hello!
I am having some trouble with the game after play again is clicked. The DropBlock method is not being invoked but all the other buttons work. When I do the dropblock method, the game speed up.
Any ideas?
Thank you!
simply brilliant
Thank you!
hi there, purchased the code and followed the tutorial, cant figure out how to run the game. please help
Thanks for buying the code. You should unzip the compressed file first and then open Tetris.sln with Visual Studio. Once opened, you can start the game by clicking the run button (green arrow) or pressing CTRL + F5. If that does not work, let me know what kind of error message you get! ☺
Sorry found my error: I had private void Window_KeyDown(object sender, KeyboardEventArgs e) instead of Window_KeyDown(object sender, KeyEventArgs e)
Hello! What a great video!
I haven't made the project yet but have a quick question, I notice that you use individual tile pictures to make a whole block, can I use the entire png of the block instead of using this method? I wish to make my own fun spin on Tetris with a different style to the blocks, maybe something like animals!
Thanks!
It is possible but you would have to change the code to display your blocks correctly. Also keep in mind that your blocks will be chopped up when the player clears a row.
i cant put a length and tiles help me plsss i need help somebody :
help me plsssssss :
amazing video, do you consider this project as a beginner or intermediate project
Thanks! I'd say this is an intermediate project but on the easy side 😉
el Id del bloque I Me esta marcando error y lo tengo igual al del minuto 11:28
Sir I just watched ur video big fan sir
U deserve respect coz u r a very talented person.
I'll subscribe u from my all 5 RUclips accounts 🙂❤️❤️❤️
Wow, thank you so much! Glad you enjoyed it 🤩 Next video will be out next week 😃
@@OttoBotCode Job done sir 😌 5 added..
@@mrstickman6718 Awesome, thanks again!
I bought it, but why isn't it working? I've been doing it for days, but I keep getting errors
Thanks for buying the code. The issue probably has something to do with your Visual Studio setup. What errors do you get? If you prefer, you can also contact me at ottobotcodehelp@gmail.com 😊
at what moment does the Hold appear on the screen, that is, when this event occurs
i love this! thank you so much please do mmore
Good afternoon! I have a problem in the code. I am writing on Visual stusio 2017. Everything is clearly written in code, but the O-block is not displayed. It is displayed transparent on the playing field, although it is displayed in the HOLD and NEXT fields.
The hold and next fields display the Block-O.png image. On the playing field, an O-block is displayed using four instances of TileYellow.png. I suspect that Tile-Yellow.png is not loaded correctly in your project.
Make sure that Tile-Yellow.png has build action set to "Resource" and double check that you have written the filename correctly in MainWindow.xaml.cs.
Let me know if this resolves the issue! 😊
Inconsistent accessibility: property type 'Position[][]' is less accessible than property 'Block.Tiles'?
I would guess that your Position class is "internal" or "private". Make sure the Position class is "public". Inside Position.cs, the code should be: public class Position 😀
@@OttoBotCode Thank you very much!
I wrote the code as in the video, but for some reason cells and blocks are not drawn in my Canvas
ok, i I tried manually inserting the green cell image, but when i start app, my canvas is empty
@@akainktsn It's probably not an issue with your code then. Make sure that your assets have "Build Action" set to "Resource"
I’m trying to make dr.Mario and using the grid really helped. How would you go about making things fall in dr.Mario?
I am glad that it helped you. Many games are easiest to implement using some kind of grid. Unfortunately, I am not familiar with dr.Mario, but best of luck with your project 😀
@@OttoBotCode thank you!
Damn I found a good channel, sub++
Haha thanks!
There's a video on In The setup's channel about free DAWs, alternatives, and even if you can't afford it you can "get" it. Not quite an
Incredible video. I have a question, why did u use public abstract classes???
You don't need to make it public, that's just how I was taught programming. Using "abstract" does make a lot of sense because we don't want the Block class to be instantiated directly (only the subclasses).
Hi, I have used the code exactly how you have but the blocks won't move down I was wondering if you knew why this would be?
It's hard for me to guess what the issue is.
The source code for the project is available here for 3$:
www.patreon.com/OttoBotCode/shop.
If that doesn't help you locate the mistake, then I can take a look at your project 😊
its beutiful how you animate this to show it. i dont know how you do it but it shows us really well. thanks a lot. im gonna make this on my school computer and im making snake at home
Thank you for the kind words! Best of luck with both projects 😀
I have a question. What should i do if i want to tetris 3d? How should i set the positions and change 'Block' class? I am not sure honestly how many position state.
I can’t drag content / sample into my playlist on Mac? Anyone know how to fix
we need to watch this vid for exam c# wish me luck
Best of luck!
I hope i get an answer after all the time :D
The .Reset(); method at 14:38 is red underlined because its not defined and either am blind or you didn't shown it.
What to write in it if i create the method?
It's around 10:45
Hey, where you learned programming like that? Any Books or only tutorials from yt, maybe some studies(I ask out of curiosity).
About same game, this is really simple explain and coding, good work.
Hello! I have a bachelor's degree in "Software Development" and a master's degree in "Computer Science" 😊 Whenever I find something that interests me, I like to try it myself and create some small project 😉 Great that you like this one!
thank you youre the best bro
Thank you for watching 😊
Nice tutorial, i just cracked soft soft ;)
Thank you 😊 What are you guys talking about? "soft soft" I don't get it 😂
I have had the hardest ti finding a video on soft that actually made sense to (I'm brand new with literally zero knowledge) and tNice tutorials
Thank you! 😊
Hey, I need help at 29:30 I can't get the row to clear is something wrong with it?
I get an error in IBlock at 11:15. Apparently I'm using an older version which doesn't support the notation "new(0,1)". Do you know of a way I can rewrite this so that it works?
You are right, I have omitted the type after "new" which you can only do in C# 9 or later. For older versions you have to always write the type explicitly like this:
new Position(r,c)
Hope that helps! 😃
@@OttoBotCode This resolved my problem, thank you very much!
This is a super cool tutorial, thanks!
@@OttoBotCodeI kept wanting to reach through the screen and rewrite your code to use the new C#11 collection initializers and then I realized this was 2 years old. 😂
Great video! Subscribed.
I also want to ask about how can you think about what function to create
and how would you create it..
for example create a basic function that can be called later inside another function ..
how do you think about it?
Does this comes from experience and you just instinctively create all the functions in one go?
is there a mathematics that can help us create the desired function?
Does math function is really important in programming? for example a composite function is that necessary to learn for programming..
i honestly dont know what function to create but you just seamlessly code that without any troubles..
What you don't see in the video is the process of planning everything and structured the code to be as easy to understand as possible.
There are design principles and standard patterns you can follow to some extent. That being said, there is no substitute for practice. With time you will develop a feel for what "good" code and "bad" code is.
How important is math? That really depends on what you want to do. For most projects it's not so important in my opinion. It's more important to think logically and keep the code as simple as possible.
BUT the really impressive programs like ray tracers, machine learning algorithms and game engines require a lot of math! 😉
First, thanks for the tutorial. I have an Issue that is only one tetrominos spawns I can move him around and place but after that they spawn no one more
i want to know about grid ,but i dont know how to set position becase all position is 0 all omg my head.
Thank you Sir
This tutorial is amazing, i've been trying to expand the game by adding a database to make a register/login feature is there any way you can help??
i want to add a pause Function on it. Can you help? btw GREAT tutorial and worked like charm
Sorry I completely missed your comment!
The easiest way to add a pause feature would probably be to add a bool isGamePaused to MainWindow.xaml.cs.
When the user presses P (or some other key) we set isGamePaused to true if it's currently false and vice versa.
You also want to show something on the screen that indicates that the game is paused.
When isGamePaused is true, we must make sure that:
a) Pressing any key (except P) won't do anything.
b) The current block doesn't move down.
Stopping the current block from moving down can be a bit tricky, it requires modifying the game loop a bit.
The easiest (but maybe not the prettiest) way would be to add a condition like this:
if (!isGamePaused)
{
gameState.MoveBlockDown();
Draw(gameState);
}
That way each iteration of the game loop doesn't manipulate the GameState when the game is paused.
Hope this makes sense and thank you for the kind words 😊
I can't get the keys to work, I can't find anything I haven't followed perfectly as I re watch the video. The only thing that sticks out is I have a "Non-nullable field 'currentBlock' must contain a non-null value when exiting the constructor....." So I'm not sure if that has anything to do with it.
Does nothing happen when you press the arrow keys?
Try setting a breakpoint in Window_KeyDown and then run the program in Debug mode. Then let me know if that breakpoint is hit when you press the arrow keys.
@@OttoBotCode tried that. And that is about the extent of my knowledge with debugging using visual studio features. And it did not trigger the breakpoint.
@@chadgessner4412 Okay so it seems like the event handler is not registered. I think the problem is in MainWindow.xaml. Do you have this property
"KeyDown="Window_KeyDown" on the Window?
@@OttoBotCode I may have found something useful... My Window_KeyDown shows '0 references' above it, but yours shows 1. Maybe I missed a line of code somewhere?
@@OttoBotCode yes that was the problem. Thanks!
Is using OOP for such small projects worth it?
I'm up to GameStateBlock and I'm a little concerned as I have several underlined code words in this block (like GameState and BlockFits) and others that you do not. I've followed you perfectly down to the exact line number on every block....... I'm using VS 17.9.3 ease my mind please?? thanks
My guess would be that the warnings disappear if you disable the "nullable" feature under project settings.
It is a newer feature which is now enabled by default when you create a project. Its purpose is to help you avoid null reference exceptions by imposing additional constraints on your code. I did not follow these constraints.
Don't worry about those warnings, the code will work just fine! For this project, I recommend disabling nullable under project settings. That should get rid of those annoying warnings!
Best of luck with the tutorial 😊
are there any other function besides "Children"? cuz im using visual studio 2019
Hi, project should comply with the following requirements:
the application should have a graphic user interface (using WinForms, WPF or similar)
all the .NET naming conventions should be followed
all the classes, variables, properties etc. should be named with a comprehensible and descriptive name
source code should be formated in a well arranged way
code shouldn't contain long methods
project doesn't contain any "dead code"
each method serves only one purpose
code is well and purposely commented
code doesn't contain old comments
code doesn't contain needless comments
data and methods working with this data are part of one class
all non-constant data fields are declared as private (and made accessible using a method or by encapsulation as a property)
inheritance represents the "IS-A" relationship
if applicable, the code is meaningfully covered by unit tests
all unit tests pass
application is divided into layers (presentation layer is separated from the application logic layer)
code doesn't contain anti-patterns or smells of code:
code doesn't contain "magic constants"
code doesn't contain "god objects"
code doesn't contain any "error hiding" anti-pattern is this project fitting these requirements best regards
I use a mac so I can't WPF file. Any other ways