Possible to do an action for each tile with a specific # ?

Get help using Construct 2

Post » Thu Mar 24, 2016 9:00 pm

This is possible to do an action for each tile with a specific number ?

Thanks in advance.
My Twitter:

@Sirvoidd

My Tutorial:

Multiplayer with Photon
B
32
S
12
G
9
Posts: 73
Reputation: 7,079

Post » Thu Mar 24, 2016 10:01 pm

I'm assuming you are referring to the tilemap object and tile ID.

Here is a quick hack -

Image

I don't think there is any way to get the tilemap width and height from expressions, so you'll have to set the number X and Y to loop through manually.

Another way would be to have your tilemap mirror data in an array, and manipulate the array, as arrays seem to be much more flexible in terms of operations.
Mistakes were made.
B
52
S
26
G
108
Posts: 1,606
Reputation: 61,133

Post » Thu Mar 24, 2016 10:22 pm

Thanks this is exactly what I tried to do :D
My Twitter:

@Sirvoidd

My Tutorial:

Multiplayer with Photon
B
32
S
12
G
9
Posts: 73
Reputation: 7,079

Post » Fri Mar 25, 2016 12:24 am

I'm not sure what you were looking for exactly but I needed some practice so made a capx that demonstrates what system expressions you can use for determining how many tiles wide/high a tilemap is:

https://www.dropbox.com/s/pcedtfjgn3i85 ... .capx?dl=0
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Fri Mar 25, 2016 12:36 am

Cool beans, that will do it. Basically get the tile index of the last tile based on its position, and use that as the upper bound for each loop.
Mistakes were made.
B
52
S
26
G
108
Posts: 1,606
Reputation: 61,133

Post » Fri Mar 25, 2016 12:57 am

Yup.

Coincidentally I made this capx about destroying tiles yesterday to reply to a forum post so I am in the Tilemap learning mood:
https://www.dropbox.com/s/z4erazryf5tb0 ... .capx?dl=0
(this one is a little more fun)
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062


Return to How do I....?

Who is online

Users browsing this forum: KTML5, newt and 30 guests