# How do can I create patterns

0 favourites
• 13 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
• Can anyone guide me in the right direction?

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

Thanks!

• x+1*tilewidth

y+1*tileheight

x-1*tilewidth

y-1*tileheight

Given that you want to place squares around the center tile, clockwise.

• That helped. Thanks Newt!

• Alternatively we can use loop with simple math

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

For example:

• 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...

• Just like what beufreecasse said and my following suggestion.

Take a look at the topic below to generate random pattern:

You just need to adjust the variable maxRoomSize to fit your needs.

• Thanks. You guys are awesome! alextro that last tip is similar to what I looking for. I can work with that!!!

• ## Try Construct 3

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

Construct 3 users don't see these ads
• 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.

• 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

• Thanks alextro! I wish my 5th grade teachers were as helpful as you and the other people on this website!

• I have another question about patterns. Say I got a screen size 4000 x 2000 and I want to use a for loop to create 20 instances of a object vertically at the center of the screen at 2000 x 1000, how can I accomplish this. Because every time I try all the object appear on the left side of the screen.

alextro maybe you help me with this.

• That's would be pretty straight. You just need to set the condition that create 20 tiles on start of layout then put them into a middle of layout screen.

https://dl.dropboxusercontent.com/u/659 ... tiles.capx

• 13 posts