Skip to content

Commit

Permalink
add more posAt helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Jan 10, 2025
1 parent 4d51bd9 commit c929076
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions flixel/tile/FlxBaseTilemap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,30 @@ class FlxBaseTilemap<Tile:FlxObject> extends FlxObject
return y + row * getTileHeight() + (midpoint ? getTileHeight() * 0.5 : 0);
}

/**
* Get the world position of the column at the specified location
*
* @param worldX An X coordinate in the world
* @param midpoint Whether to use the tile's midpoint, or left edge
* @since 5.10.0
*/
public function getColumnPosAt(worldX:Float, midpoint = false):Float
{
return getColumnPos(getColumnAt(worldX), midPoint);
}

/**
* Get the world position of the row at the specified location
*
* @param worldY An X coordinate in the world
* @param midpoint Whether to use the tile's midpoint, or upper edge
* @since 5.10.0
*/
public function getRowPosAt(worldY:Float, midpoint = false):Float
{
return getRowPos(getRowAt(worldY), midPoint);
}

/**
* Get the size of a column, in world coordinates
*
Expand Down

0 comments on commit c929076

Please sign in to comment.