Game Development Community

About tetris tutorial

by Playware · in Torque Game Builder · 09/01/2006 (3:45 am) · 2 replies

Hi,

I was tring to do the tetris tutorial. In this,under topic - "Current Shape", there is said

...........................................................................................................................................
Finally we need to give the current and next shapes a value, we can do this in startGame by copying a random shape - assuming you've defined all 7 shapes :)
...........................................................................................................................................

Now, here I feel little bit confused. It is saying about defined all 7 shapes. Where i have to define these shapes. I have made these 7 shapes in diffrent-different layers. Do i need to define somewhere these also as "shapeGroup" ? if yes then where and How ?

If anyone has this idea , pls help me out.



Thnx.

#1
09/01/2006 (5:33 am)
I think that may be a throw back from the original version of the tutorial which defined shapes using script objects e.g

// Vertical I shape
%s = new ScriptObject();
%s.block[0,0] = 0;  %s.block[1,0] = 1; %s.block[2,0] = 0; %s.block[3,0] = 0;
%s.block[0,1] = 0;  %s.block[1,1] = 1; %s.block[2,1] = 0; %s.block[3,1] = 0;
%s.block[0,2] = 0;  %s.block[1,2] = 1; %s.block[2,2] = 0; %s.block[3,2] = 0;
%s.block[0,3] = 0;  %s.block[1,3] = 1; %s.block[2,3] = 0; %s.block[3,3] = 0;
$GAME::SHAPES[0] = %s;

The tutorial itself only provided the example code to define one shape, in the above case "I" and left the remaining shapes "as an exercise for the reader".

TGB has changed quite dramatically since then with the tutorial been updated to take advantage of the new level editing tools of TGB. I've not worked with the latest TGB yet, however reading the updated tutorial it looks like it now uses the tile editor to create all 7 shapes saving each out as separate layers. A visual pointy/click method rather than the older method of defining them in code.

You do not need to define "shapeGroup", if you look at the section called Building Blocks, in the OnAdd code it will create the required group the first time any shape that has its class set to "ShapeTemplate" is created/added to the scene.
#2
09/03/2006 (6:35 pm)
Hi,

thnx. But I am still confused, you are talking abt. manual defined shapes data. But in New TGB level builder, I made all 7 shapes in different layer and saved in /tilemaps folder of the game.

Now I am getting this error...........


myTetris/gameScripts/game.cs (28): Unable to find object: 'shapeGroup' attempting to call function 'getCount'
myTetris/gameScripts/game.cs (28): Unable to find object: 'shapeGroup' attempting to call function 'getObject'

Thats means it couldn't find the shapeGroup and getObject. Do we need to define these shapes (after making in different layer) somewhere (e.g. /datablocks.cs or ???)
How we can solve this problem ?

If anybody has any idea abt. this Pls. help me.


thnx.