# How do can I create patterns

Get help using Construct 2

### » Thu Mar 12, 2015 9:07 pm

Can anyone guide me in the right direction?

What's the best way to generate a pattern like this using one square object?

Thanks!
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 10
Reputation: 269

### » Thu Mar 12, 2015 9:39 pm

x+1*tilewidth
y+1*tileheight
x-1*tilewidth
y-1*tileheight

Given that you want to place squares around the center tile, clockwise.
B
163
S
48
G
101
Posts: 7,465
Reputation: 72,552

### » Fri Mar 13, 2015 11:28 am

That helped. Thanks Newt!
B
5
Posts: 10
Reputation: 269

### » Fri Mar 13, 2015 1:21 pm

Alternatively we can use loop with simple math
You do not have the required permissions to view the files attached to this post.
B
83
S
34
G
16
Posts: 615
Reputation: 16,402

### » Fri Mar 13, 2015 1:27 pm

Ok. So how can I create a random sequence of blocks in different patterns each time the games starts?

For example:
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 10
Reputation: 269

### » Fri Mar 13, 2015 2:30 pm

Hi,

you could make the code for each sequence you need and use a round(random(0,X)).
So when round(random(0,X)) = 1 you could call the code for sequence 1...
B
14
S
4
G
2
Posts: 190
Reputation: 3,938

### » Sat Mar 14, 2015 1:42 pm

Just like what @beufreecasse said and my following suggestion.
Take a look at the topic below to generate random pattern:
viewtopic.php?f=147&t=122780&p=874648#p874648

You just need to adjust the variable maxRoomSize to fit your needs.
B
83
S
34
G
16
Posts: 615
Reputation: 16,402

### » Sun Mar 15, 2015 4:59 pm

Thanks. You guys are awesome! alextro that last tip is similar to what I looking for. I can work with that!!!
B
5
Posts: 10
Reputation: 269

### » Fri Mar 20, 2015 5:22 pm

@alextro, if you don't mind can you explain what the events are doing. And what if I want to generate just 10 different unique patterns?

Thanks.
B
5
Posts: 10
Reputation: 269

### » Fri Mar 20, 2015 6:55 pm

I have an issue submitting an attachment, so take a look screenshot below.

Here you go:

Just add < RoomTile | spawn sensor > in first event and duplicate the RoomTiles in layout as much as you needed
B
83
S
34
G
16
Posts: 615
Reputation: 16,402

Next