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
35
S
12
G
9
Posts: 73
Reputation: 7,164

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
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

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
35
S
12
G
9
Posts: 73
Reputation: 7,164

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
44
S
26
G
11
Posts: 520
Reputation: 10,506

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
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

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
44
S
26
G
11
Posts: 520
Reputation: 10,506


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests