# Grouping and Random Generations of Groups?

0 Favourites
• 3 posts
• Hello all;

Ok I have a bit of a question, I am new to this product and I am still feeling around in the dark a little. So I thought I would post here for help.

What I need to do is have a group of sprites placed together in a couple different shapes, kinda like Tetris shapes. However each block in the shape is its own color, and this is where the random colors part needs to take over. So say for arguments sake, it is a "L" shaped tetris piece, mine would have 5 colored blocks making up that same shape. which would be randomly generated before it comes onto the scene. Each color block would also have its own behaviors attached to it for color matching e.t.c But first I want to get the movement and random block generation completed. They need to be grouped together because the player will have the option to move left to right or rotate said objects.

Where do I start to get this working?

• I did a tetris game some weeks ago, and to get the shape I simply wrote down some relative coordinates.

It looked like

-2,0|-1,0|0,0|1,0#0,-2|0,-1|0,0|0,1
0,0|1,0|0,-1|1,1
-1,0|0,0|1,0|0,-1#0,-1|0,0|0,1|1,0#-1,0|0,0|1,0|0,1#0,-1|0,0|0,1|-1,0
-1,0|0,0|0,-1|1,-1#-1,-1|-1,0|0,0|0,1
-1,-1|0,-1|0,0|1,0#0,1|0,0|1,0|1,-1
-1,0|0,0|1,0|1,1#0,1|0,0|0,-1|1,-1#-1,0|-1,1|0,1|1,1#-1,1|0,1|0,0|0,-1
-1,1|-1,0|0,0|1,0#1,1|0,1|0,0|0,-1#-1,1|0,1|1,1|1,0#0,1|0,0|0,-1|-1,-1

With 4 levels of token:

a line break (newline) separates each shapes

a # separates each possible rotation

a | separates each block coordinates

a , separates X and Y coordinates.

Then I just had to select a random line, and to make it simple I just used the first rotation on spawn.

Also note that in tetris all shapes are made of 4 blocks that made things easier too.

Then I just had to know the current shape and move the blocks accordingly.

Tetris always have one shape moving at a time so it made things easy to. I just had to flag the blocks as moving or not (boolean)

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• I did a tetris game some weeks ago, and to get the shape I simply wrote down some relative coordinates.

It looked like

-2,0|-1,0|0,0|1,0#0,-2|0,-1|0,0|0,1
0,0|1,0|0,-1|1,1
-1,0|0,0|1,0|0,-1#0,-1|0,0|0,1|1,0#-1,0|0,0|1,0|0,1#0,-1|0,0|0,1|-1,0
-1,0|0,0|0,-1|1,-1#-1,-1|-1,0|0,0|0,1
-1,-1|0,-1|0,0|1,0#0,1|0,0|1,0|1,-1
-1,0|0,0|1,0|1,1#0,1|0,0|0,-1|1,-1#-1,0|-1,1|0,1|1,1#-1,1|0,1|0,0|0,-1
-1,1|-1,0|0,0|1,0#1,1|0,1|0,0|0,-1#-1,1|0,1|1,1|1,0#0,1|0,0|0,-1|-1,-1

With 4 levels of token:

a line break (newline) separates each shapes

a # separates each possible rotation

a | separates each block coordinates

a , separates X and Y coordinates.

Then I just had to select a random line, and to make it simple I just used the first rotation on spawn.

Can you please elaborate further or provide a sample capx. Thanks!