Game Development Community

Tetris blocks

by Mark Williamson · in Torque Game Builder · 08/05/2006 (3:03 pm) · 4 replies

I was just messing around trying to draw some tetris blocks. I decided my first game would be a simple tetris clone. I realize theres already a tetris gamein TDN but im not a member yet so for my 28 remaining days thats what i plan to do.

However, I drew the four shapes with the hot pink backround [255/0/255]. the tile map thing brought in the shapes ok but two of them, the T and the L are still showing the pink background. here's a screen shot:

www.webpit.com/tgbtetris.gifwww.webpit.com/blocks.png
I may not be going about this the right way. Would it be simpler to have only one shape [a square] and then assemble it into the various pieces in script?

#1
08/05/2006 (3:06 pm)
I think I just figured out the answer

either a) use just one square and assemble the pieces on the fly
or b) split the L and T into two sprites, one with a bar 3 squares high, the other with one square, and position it in script.

thoughts?
#2
08/05/2006 (4:27 pm)
I'd personally do it as one block and assemble the bits on the fly. I'd also be tempted to make the block greyscale so you can use the .setBlendColour options to colour the blocks. No need to have seperate images for different colours then.

With regard to your background showing through, the KEY mode doesn't use the key colour as transparancy, only as a way to split images up into chunks. If you want transparency, save it as a PNG with a transparent background and use the CELL options to grab your individual graphics.
#3
08/07/2006 (9:35 pm)
Thanks for the clarification. Yes, I was kinda assuming that it was doing transparency, so now I know :)
#4
08/09/2006 (9:35 pm)
Mark,

You can absolutely you KEY mode with transparencies. Key mode will select rectangles based on the width and height of the 'texture' it finds. For example, I have just modified your below png to reflect transparencies on those two shapes and imported it fine. Hope this helps :)

www.uiObsession.com/images/gg/blocks.png
-->

www.uiObsession.com/images/gg/tetris.jpg
Cheers,
-Justin