How do I change tile on collision? Set location to tile?

Get help using Construct 2

Post » Thu Feb 04, 2016 8:24 am

When using the tiled background object, the tile map is split up by numbered tiles. If I use tile 1 for grass but want to set it to a dirt tile in position 2 on collision, or set spawned objects to "tile 1" locations, how would I go about doing that?

I looked through the tiled object properties and it didn't look like I could do much other than set the tile to flipped or something.
Posts: 22
Reputation: 244

Post » Thu Feb 04, 2016 7:30 pm

Please let me know if I need to be more clear.. It sounds so simple but I'm not able to figure it out.
Posts: 22
Reputation: 244

Post » Thu Feb 04, 2016 8:07 pm

There are two tilemap expressions TileToPosition and PositionToTile with that you should do what you want. For example change Tile on a positionXY:
Sprite| Is overlapping Tilemap -> Tilemap| set Tile(Tilemap.PositionToTileX(Sprite.X),Tilemap.PositionToTileY(Sprite.Y) to tile 1

Create object on a tile number 10 in x and tile number 10 in y.
event -> System| Create object Sprite (Tilemap.TileToPositionX(10),Tilemap.TileToPositionY(10))
Posts: 497
Reputation: 2,324

Return to How do I....?

Who is online

Users browsing this forum: Ashley, Lancifer and 3 guests