Code-It-Yourself! Tetris - Programming from Scratch (Quick and Simple C++)

Code-It-Yourself! Tetris - Programming from Scratch (Quick and Simple C++)

javidx9

7 лет назад

1,494,254 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

javidx9
javidx9 - 12.07.2019 23:33

lol, because I've answered this 200 times now, please ensure you have unicode enabled for your compiler. In VS, that's Project Properties -> General -> Character Set.

Ответить
T
T - 17.09.2023 18:56

I dread to imagine what operator overloading and template shenanigans are inside the std library to make '50ms' a valid numerical constant. It is easier to type than std::chrono::milliseconds(50) I guess.

Edit : it seems like there's an operator""ms which does it. How wonderfully devious.

constexpr std::chrono::milliseconds operator""ms(unsigned long long ms)
{
return std::chrono::milliseconds(ms);
}

Ответить
Alex Nascimento
Alex Nascimento - 19.08.2023 23:12

I've tried to run the whole code not seeing the video. The code doesn't run. It gives a error " 'BOOL WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD)': não é possível converter um argumento 2 de 'wchar_t *' em 'LPCSTR'"


Should I continue?

Ответить
Chastity Rose
Chastity Rose - 18.08.2023 04:52

This video puts me to shame because the methods I used are a lot bigger code and simpler for me to understand. At the same time, I was trying to add a lot more features than just a basic console demo and so that’s how I ended up with 30 kilobytes of code.

Ответить
Chastity Rose
Chastity Rose - 18.08.2023 04:22

5 minutes in and you are showing the exact formula I used in my Tetris game. In my case it was a[x+y*width]

Ответить
OzzyFan69
OzzyFan69 - 17.08.2023 05:37

Not sure if anyone else ran into this issue, but I had to change `WriteConsoleOutputCharacter(...)` to `WriteConsoleOutputCharacterW(...)` the original one was throwing conversion errors for w_chart and LPCSTRs

Ответить
Pennsylvania RR S2 6-8-6 Steam Turbine Locomotive
Pennsylvania RR S2 6-8-6 Steam Turbine Locomotive - 23.07.2023 00:13

Hey i did it myself! Im a good programmer 😎

Ответить
Mykhailo Glivinskyi
Mykhailo Glivinskyi - 21.07.2023 11:31

please take a look, there is much eleganter way of this game. it was written on Python.
It needs only a few lines of code:

from games import tetrisgame as t
t.playmode("hard")
t.start()
if ThereIsNoHumor
ThereIsNoHummor=False

Ответить
fenglin ou
fenglin ou - 22.06.2023 08:45

Thank you! I can't help but modify the code that you shared.😁

Ответить
miguel rainho
miguel rainho - 07.06.2023 01:31

Hello! I have an issue where the console will still read user input even thought the game is running!
For example, if I press Z to rotate the piece a couple of times and then exit the program, the console will have zzzzzzzzz written in it.
How can I fix this?

Thanks for the amazing tutorial btw

Ответить
Railur
Railur - 17.05.2023 22:45

What does that L in front of the string literal mean? That the literal is to be taken as a string of unicode chars?

Ответить
Zack Labs
Zack Labs - 16.05.2023 07:16

My favorite part of the video was when he said: "it's coding time," and proceeded to code all over the place.

Ответить
Spade
Spade - 30.04.2023 21:29

6 Years Later and You Still Reply to Comments, how admirable. thank you for your hard work. I plan to follow most of the "Do-It-Yourself" Series because I want to try and make a 3D Voxel Game with c++ and think they would help.

Ответить
Coding
Coding - 28.04.2023 06:59

a lot of unnecessary bullshit

Ответить
Gino Carlo
Gino Carlo - 16.04.2023 04:29

My code doesn't work in any way. I have been searching for more than 4 hours :(

It runs on my visual studio, but it does not show nothing, it doesn't open no screen

Ответить
นดรไน สมัยสร
นดรไน สมัยสร - 08.04.2023 01:27

I’m so curious how can the Tetris pieces be draw as a shape 4x4 the Field too how can the program draw it out to be the shape like that I don’t mean replacing the 0-9 with those # or A character I mean the Tetris shape 4x4 and the level shape 18x12

Ответить
Veks
Veks - 15.03.2023 20:10

Why can't anyone explain buffer overrun problem...

Ответить
Jeffery Caldwell
Jeffery Caldwell - 07.03.2023 22:03

Is there a specific version (posix?) of MinGW on windows that this works with? I'm kinda new to C/C++ on windows and can't get the sample from github to compile.

Ответить
Shankar
Shankar - 02.03.2023 22:09

I want to research this . what is it called ? screen[(y + 2)*nScreenWidth + (x + 2)] = L" ABCDEFG=#"[pField[y*nFieldWidth + x]];

Ответить
Games Garden
Games Garden - 28.02.2023 20:41

Nice one! I used for rotation another approach. To rotate any position (x, y) around center (0, 0) you can use formula x = y; y = -1 for CW rotation, and x = - y; y = x for CCW.

Ответить
mr_noodler
mr_noodler - 12.02.2023 07:34

I did a code along to this, and got it working! What a thrill! I had a lot of fun. I like coding along while you are explaining things so I get a feel of how it works. Some of it made my brain numb but I suppose it's just part of learning. Great video! Thanks for making it, I learned a lot, especially about handles to the console window, cool stuff!

Ответить
placek
placek - 18.01.2023 22:11

When i finish c++ tutorial i found, i will surely watch some videos. I dont see tutorials, i see challanges that will improve my c++ skills. I will try to make programs from each video and during the making of it i will try to watch as little as possible of these videos. At the end of each challange i will compare my result to yours, it will be fun.

Ответить
Anh Vo
Anh Vo - 04.01.2023 07:21

im coding on mac and can't include windows.h, is there any alternative or what should i do with this problem?

Ответить
FaÐingmem¤ry✘
FaÐingmem¤ry✘ - 20.12.2022 21:23

javidx9 and his discord mods hate transpeople, always singling me out and being absolutely nasty to me! Going to report his server until this treatment is fixed.

Ответить
mr_noodler
mr_noodler - 17.12.2022 05:27

This guy is legendary, so inspiring!

Ответить
Sensi Mufasa
Sensi Mufasa - 02.12.2022 23:42

For years now I this channels thumbnails and I say to myself... One day... I will pick up the remanents of my failed programmer ass, and start doing these tutorials. because thats the kind of programming i always wanted to do

Ответить
QuiYi MC 秋衣
QuiYi MC 秋衣 - 28.11.2022 06:02

Very interesting sir

Ответить
BBQGiraffe
BBQGiraffe - 24.11.2022 06:32

implementing this in C on my 6502 homebrew, I got a NES controller and LCD working but I'm too dumb to know how tetris works so this is helpful :3

Ответить
Astaghfirullahalzim Astaghfirullahalzim
Astaghfirullahalzim Astaghfirullahalzim - 10.11.2022 12:17

thanks to you now i am able to resolve 3d array into 1d array also:
using
f(x,y,z)=index
f(x,y,z)=width*y*depth+x*depth+z

i dont know whether someone has found this formula before..
but i just found this formula and i am so happy with this..
i found this formula by trying to draw 3d array as a cube and just try and error what will happen if...
and then i found this formula..
maybe god helps me with this thank to god
and also thank to you because you showed how to resolve 2d into 1d array

Ответить
Chandra Gunawan
Chandra Gunawan - 09.11.2022 20:49

current had been following the video for 12 mins.
im stuck with the test compile the program. the program successfully compiled but cant run (incompatible version) and when im compiling using other compiler, it throws a lot of errors such as 'byte is ambiguous'.

i was beginner on C++.
anyone ever had this problem before ?

Ответить
mr cookies
mr cookies - 01.11.2022 19:46

I am wondering if it is possible to compile this on the linux command line easily(like changing a few lines) or would parts of the program have to be rewritten completely?

Ответить
Jake Whiney
Jake Whiney - 28.09.2022 11:26

I've been looking for a fellow like you for months. Thank you for your content it'll help me rise from a basic understanding of programming to a practical tangible experience I've been looking for.

Ответить
Rapturian
Rapturian - 19.09.2022 21:05

after 34th minute, I get a bug. When I start the program, a shape appears with letters A. Then the shape goes down second by second. When it reaches out the base, then 4 rows with "equal signs" like this "=" appears. For the second shape with is fulled with G letters, same problem occurs. When the shape reaches out to the base and there will be no space to go down, 4 rows "=" signs appears and then these "=" signs disappears. How can I solve this bug? Thanks.

Ответить
tamir rozenfeld
tamir rozenfeld - 26.08.2022 21:41

hello
javidx9
I am walking through a c++ course right now and planning to walk through all your "code it yourself video" afterward is this playlist good for programming and c++ in general or the information is mostly for gaming .
Thank you very much!

Ответить
RATTLE ME SPOONS
RATTLE ME SPOONS - 23.08.2022 23:11

Javidx9, I just want you to know, you are a Giga-chad (that's a compliment) for actually managing to make your own NES emulator, and coding tetris from scratch using friggin' C++.
One day I hope I can make my own game engine.

Ответить
WilliamVlogs
WilliamVlogs - 02.08.2022 23:13

do an update using ncurses to be crossplatform. for the gotxy function of cursor printing

Ответить
enes sabanovic
enes sabanovic - 24.07.2022 12:01

Didn't work for me with the settings provided however if I increase the screen width to 120 it works great!

Ответить
KhaoticTTV
KhaoticTTV - 22.07.2022 06:13

Why are you still using windows? Should all developers be using macOS by this time?

Ответить
Astaghfirullahalzim Astaghfirullahalzim
Astaghfirullahalzim Astaghfirullahalzim - 10.07.2022 17:45

Mr, i am stuck while trying to program tetris in olcPixelGameEngine could you make a video on how to do it..
i only manage to make square shape and "I" shape asset..
and make it fall down on its own..
(because that part is taught in the tutorial section in the wiki tab in Github)
for other assets i failed to even draw it in its initial position..
its very challenging for me since you have to move the asset down automatically with that unsymmetry shape..
drawing is solely on nested for loop..
one loop for x coordinate and another for y coordinate..
i tried to draw based on boolean array..
but seems that would need more and more explicit programming
(and i tried to avoid that)
because for example my asset is 20 pixels wide and 20 pixels height
i dont know what mathematic to apply..
can some one help?

Ответить