Minigame Monday: 3D Tetris
3D Tetris:
- The concept:
I wanted to do another full sized minigame now that the game jam has finished (expect a post on that later in the week). This was actually an idea from my father, and it gave a number of interesting programming challenges so I decided on it as soon as I heard it. The idea itself is explained pretty well by the title; tetris, but in three dimensions.
- The challenge:
The first issue for this game was how to represent the grid. I could have had each square control itself, and consider squares around it to decide when layers should be cleared, but I decided to have an overaching controller to handle it. I instantiated a cube in each possible spot on the gameplay area, and then used the controller to enable/disable the cubes and set their colour. Although doing this did involve a number of loops, as the game won't have large dimentions these loops won't be so large. As well as that, instantiating the cubes at the begining and enabling/disabling them is more efficient than instatiating them as blocks fall into the correct position (although of course it's unlikely to matter for a game of this size).
Checking for layers being complete didn't prove too difficult; to test it I wrote a quick line of code to randomly enable blocks, so I could see the lines being cleared, and check if blocks were being moved down correctly. Doing so made a slightly trippy effect of the block spawning:
Lots of colours... |
- The result:
I achived what I was setting out to do when I made this game, in that it's 3D Tetris. On the other hand, there are plenty of things I'd have liked to add to the game; a display for the next blocks coming; vertical rotation, and increasing drop speed, to name just a few. Play the game for yourself at https://reddragonmakesgames.itch.io/3d-tetris, and the assets and code are on my github.
Comments
Post a Comment