How do I randomize specific tiles?

Get help using Construct 2

Post » Sun Mar 06, 2016 2:49 pm

I'm bad at explaining this so I made a quick mockup picture.
Basically what I want to happen is that since I'm using the flat tiles with no decorations to build my map. I would like to create few tiles with random decorations, as you can see i quickly made with paint for the picture. And when the layout starts for every tile there is a say 1/10 chance to change into a random tile that is the same spot but has decoration on it. You know to make the game look a bit more randomized and not just a big blank box.
Is this possible to do with C2?
Image

something like this:
on layout start if tile is "1"
change tile to: "choose (1,1,1,1,1,1,1,1,1,2)"
B
10
S
2
G
1
Posts: 51
Reputation: 848

Post » Sun Mar 06, 2016 3:01 pm

This should work:

+System: On start of Layout
+System: For "x" from 0 to Tilemap.Width/32
+System: For "y" from 0 to Tilemap.Height/32
+Tilemap: Tile (loopindex("x"), loopindex("y")) = 1 -> Tilemap: Set tile (loopindex("x"), loopindex("y")) to tile choose(1,1,1,1,1,1,1,1,1,2)


Edit: "32" = size of your Tile - 32x32 in this case
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343


Return to How do I....?

Who is online

Users browsing this forum: Apollo14 and 27 guests