Share your repls and programming experiences

← Back to all posts
3D Tetris :D
phazrlazr (38)

This is Tetris but in 3D. So the pieces you control are no longer called tetrominoes, they're now called tetracubes. And the number of blocks for each piece is consistent. But otherwise, this plays like normal Tetris. The controls are stated in the game.

Here is a screenshot of the game. I am getting a tetris for the first time in 3D tetris.

In case you don't know how to play Tetris, in 2D (normal) Tetris you gain points and progress through the game by clearing lines. That is done by filling an entire line with blocks. If you reach the top of the play area you lose. So in this 3D Tetris, since the "3D version" of lines are planes, you clear planes instead of lines. The controls, as I stated, are in the game.

I was reading from an OpenGL tutorial and after I finished reading enough that I could probably make something on my own, I thought of making Tetris. In 3D. I've always wondered how 3D Tetris would play like. I decided to make it in WebGL instead because of portability (my friends would probably hesitate running an .exe file I gave them), and I found out the WebGL API is basically just OpenGL but it's in JavaScript instead of C; they even have the same function names. (Except GLSL is different, that was kinda annoying).

It would be cool if someone can fork this but use all the pentacubes instead of all the tetracubes. I looked it up and found a picutre of all 29 of them.
Of course I could just do that myself, but I'm lazy I guess I dunno.

Creatito1 (6)

This is amazing, the only thing that could be better is maybe a better layout for the controls.

phazrlazr (38)

@Creatito1 I realize now that the layout definitely isn't the best if you're using a mouse. I was using a touchpad and I guess that people without touchpads are a lot more common, so I changed the layout to better accommodate for the lack of a readily available right hand for the keyboard. Thanks for telling me that.

Creatito1 (6)

@phazrlazr Did I do something wrong, I wanted to see the new controls and this happens:

It worked fine before?

Creatito1 (6)

Oh never mind I got it with this:

phazrlazr (38)

@Creatito1 weird, I don't have that enabled and it works perfectly fine. And WebGL initialization is definitely not an extension that is still in draft status... This is the line of code that initializes WebGL immediately before checking if it is properly initialized:

gl = canvas.getContext("webgl");
Creatito1 (6)

@phazrlazr well that’s interesting but it works so... whatever

Jasperscode (14)

someone make hacks and mods for this game

ch1ck3n (2088)

Its amazing how some new people are taken a rise in repl talk than the famous people

elburg (41)

this is truly beautiful...