I've thought for a long time about trying to write a Tetris game. I know there are already some out there, but just to do it for my own pleasure.
I certainly don't need any help writing code, but what I seem to have a difficult time with is the actual logic to how this would work. You have different shapes of pieces falling, each piece made of 4 little squares. So, in the program code, do you treat it as one piece or do you treat it as 4 falling pieces? Either way seems to present a set of challenges in regards to rotation and detecting when it has hit the bottom.
I saw a Tetris done in like 20-some-odd lines of Basic code one time, and I couldn't make heads or tails of it. I'd probably write mine in assembler, but the point remains I need to figure out how to approach the task first.
How to program Tetris.
Moderator: Moderators
Re: How to program Tetris.
That 20 Line Tetris was awesome! I also had trouble really understanding it. Collision detection, I guess I would call it, is really difficult.adric22 wrote:I saw a Tetris done in like 20-some-odd lines of Basic code one time, and I couldn't make heads or tails of it. I'd probably write mine in assembler, but the point remains I need to figure out how to approach the task first.
Wow.. I tried the game. It is fantastic, too bad it wasn't around in the 1980's. It is actually better than the C64 official version of Tetris. Sad, huh? I can't say that I like the design of the blocks, though. I would have used a different character pattern.nbla000 wrote:take a look to the source of Tetris+
Anyway, I'll check out the source later.
Look very nice! Source code isn't downloadable ...nbla000 wrote:take a look to the source of Tetris+