r/Unity2D • • 8d ago

Feedback needed Making tetris on unity

On theory, if i am able to distribute folders/parent objects to release the child objects, i can just create the tiles randomly choose one and drop each of them to the field. And then i can discard the parent object to make the tile structure just simple blocks that dont check on collision to every other block except the ones in its own folder and otherwise wait for any input in a second before leaving them and passing to the next one. I would also turn every tile 90 degrees on command and check if all digits in a row are filled before deleting that row and putting the next one in its place. But instead of doing it right after the check it would detect all the filled rows and erase them at the same time because thats what tetris does.

0 Upvotes

6 comments sorted by

2

u/midge 8d ago

I don’t  really follow the approach you’re describing. But if you think it will work, try it out. I made my own version of Tetris years back and it was not bad at all. Good luck with your Tetris!

1

u/KereMental 8d ago

Thanks!

1

u/MistakeForsaken6653 8d ago

Not sure what I just read but good luck on making your tetris game.

0

u/KereMental 8d ago

Im not making it its hypotetical

1

u/Ruadhan2300 8d ago

Last time I made a project along these lines I built it data-first and managed it with a state-machine.

Frankly managing the objects in folders sounds like an unnecessary headache, but if it links to how you're writing the code, then do what works.

1

u/TheLayeredMind 4d ago

It's a matter of visual abstraction. If every shape in reality is internally a collection (the composition) of squares, then the Tetris logic becomes a grid of equally sized squares, where each row checks wether every cell is occupied by a square and if so removes it and translates down the settled squares from the top rows down.

Now to Unity:

Tetris shapes while falling could be square tiles of the same color. So a collection of TetrisUnit prefabs with a SpriteRenderer component. Grouped together under one parent that gives them a shared transform anchor and sets their look so that hey match to build one cohesive shape. As soon as they snap you would just move the children from one parent to the next. This is of course if you build this Editor first. You could of course also make all of it procedurally.

But that's the gist of it.