Change a Tilemap Tile with a 9Patch

Get help using Construct 2

Post » Thu Jan 30, 2014 1:04 am

My plan is to have a 9Patch rectangle draw over a Tilemap, and when I release the mouse, all tiles below the 9Patch will change to a different tile in the Tilemap.

Is this possible, or do the two Objects not interact with each other in this way ?
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Thu Jan 30, 2014 1:21 am

You can use "Set tile range" in Tilemap object to do what you want and then use 9patch to only visualize area of selection.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Thu Jan 30, 2014 3:50 am

That's what I'm doing, but I can't set each Tilemap tile under the 9patch.

I was hoping I could do 'For each tilemap tile under 9patch, set tile to 2'
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Thu Jan 30, 2014 12:51 pm

9patchTileselection.capx

"Set tile range" is a bit confusing at start. Because Tile X and Tile Y are index numbers of tiles (not XY position coordinates) and Width and Height are the same - how many tiles horizontally and vertically you want to affect (not pixels).
shinkan2014-01-30 12:57:06
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Thu Jan 30, 2014 9:45 pm

That's it !!! Thank you, I'm still new to Tilemaps and this was a massive help !
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Fri Jan 31, 2014 10:46 am

\I've adapted the CAPX that you have made, and now I'm trying to get it to sense if there is a tile already there, on the bottom tilemap, and if it does sense one, then to leave that spot blank on the top tilemap.

So far I have this, https://dl.dropboxusercontent.com/u/108799982/Capx%20Demos/OverlappingTilemaps.capx , but I'm afraid it's not working. Would you be able to give me one last assist ?
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Fri Jan 31, 2014 2:37 pm

Is this what you want?
OverlappingTilemaps2.capx

Its erasing all tiles from Tilemap2 if they have same XY position as Tilemap1 - so you can make Tilemap2 tiles only on blank spaces of tilemap1.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Fri Jan 31, 2014 9:41 pm

Indeed it is, you sir are a genius
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, jezjones24 and 19 guests