Teleport From Tile to Tile

Get help using Construct 2

Post » Wed Nov 23, 2016 5:05 am

I want to be able to reference a tile location on a tile map so on Right Click - Player moves to tile instantly no matter how far it is as long as it doesn't contain a solid object.

I am hoping to be able to do this with as few objects as possible for maximum fps.

I hope this is very clear. If not please tell me what you need.
B
18
S
8
G
1
Posts: 56
Reputation: 2,018

Post » Wed Nov 23, 2016 6:13 am

You have to use the Tilemap.PositionToTile event.

Here's an example for a 32x32 grid:

https://dl.dropboxusercontent.com/u/238 ... otile.capx

You just have to compare the tile the mouse was clicked at. If it's -1 it means there was no tile there. You could also compare it to an empty tile if you have one in your tilemap, you'd just change that number.

if it is empty, it re-positions the sprite to a 32x32 grid. If your grid is different you just have to change both numbers.
B
124
S
43
G
41
Posts: 849
Reputation: 28,235

Post » Thu Nov 24, 2016 2:05 am

Thank you so much, this works perfectly!
B
18
S
8
G
1
Posts: 56
Reputation: 2,018


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 43 guests