CanvasToLayerX or PositionToTileX error.

Get help using Construct 2

Post » Sat Apr 11, 2015 9:49 pm

I'm scaling a layer, which contains a tilemap, using the 'CanvasToLayerX' etc commands (which I find very confusing, but they seem to work). I then find the position that's been clicked/touched with 'MyTileMap.PositionToTileX(Touch.X("TileMapLayer")) (same for Y obviously).

It works fine on my PC, a friend's PC and on my phone, but it doesn't work on his phone. It looks fine and seems to scale correctly, but the touch command is returning the wrong tile.

Since it looks ok, I'm guessing my 'CanvasToLayerX' command is correct....

CanvasToLayerX("TileMapLayer",LayerToCanvasX("Background",TileMapX,TileMapY),LayerToCanvasY("Background",TileMapX,TileMapY)) .... (that's just the X, same is done for Y). This is obviously just to ensure that it's centred correctly on the screen, using the 'Background' layer which isn't scaled or offset or anything.

Looks ridiculously complicated and I won't pretend to understand it, but it does work.

So am I using the wrong command for the input, or am I doing something obviously wrong?
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Return to How do I....?

Who is online

Users browsing this forum: Benjo11, dzert14, imhotep22, mdvgames, yodashii and 3 guests