Is This a Bug in TileToPosition ( Tilemap )?

From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hi , Im using the Tile to Position to get the X and Y Layout Coordinates from tiles

    After I get the information I sow a large number so I divided it by the tile size , so far so good

    but it shows me a difference of 0.5 in the layout X and the Layout Y coordinates

    how can I fix it ?

    Link to c3 project

    dropbox.com/s/eue286nkqvo2hf6/tiletopositionBug.c3p

    Tagged:

  • TileToPosition expression takes tile number as parameter, not a layout coordinate. You probably need SnapX/SnapY expression here instead.

  • dop2000 Thanks for answer but its not what the documentation says :

    Snap(x)

    Snap(y)

    Snap an X or Y layout co-ordinate to the nearest tile. This also returns a layout co-ordinate, but aligned to the nearest tile in the tilemap.

    and thats not what I need , I need TiletoPosition insted

    TileToPositionX(x)

    TileToPositionY(y)

    Convert a tile position to layout co-ordinates. For example, this can be used to position a Sprite object on top of a given tile.

    I think this is a Bug

  • Like I said, TileToPositionX() expression requires tile number. It won't work if you use Sprite.x as a parameter.

    You can do this:

    TileToPositionX(int((Sprite.X-Tilemap.X)/16))

    but it will be the same as SnapX(Sprite.x)

    .

    If you need to get tile number (or index) for a given position, use PositionToTile expressions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks dop2000 I misunderstood the documentation , I thouht when sprite overlapp the tiles it already takes the tile number .

    Now its working with Snap , and the other way you said . Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)