CanvasToLayerX or PositionToTileX error.

0 favourites
  • 1 posts
From the Asset Store
7 Errors
$15 USD
7 Errors is a game where you have to find the 7 mistakes before time runs out. Can you find all 7? Have fun looking.
  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)