Grouping and Random Generations of Groups?

Get help using Construct 2

Post » Sun Mar 18, 2012 12:05 pm

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?

Thanks in advance for your time.
B
15
S
4
Posts: 8
Reputation: 1,348

Post » Sun Mar 18, 2012 1:14 pm

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

It looked like
[code]-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[/code]
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)
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Aug 11, 2012 4:40 pm

[QUOTE=Yann] I did a tetris game some weeks ago, and to get the shape I simply wrote down some relative coordinates.

It looked like
[code]-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[/code]
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.[/QUOTE]

Can you please elaborate further or provide a sample capx. Thanks!
Moving Mazes - Action Puzzle game with a twist!
Play it now: http://www.cre80ve.com
B
15
S
3
G
1
Posts: 17
Reputation: 2,616


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests