diff options
author | kobewi <kobewi4e@gmail.com> | 2022-09-13 01:27:10 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-09-13 01:39:35 +0200 |
commit | 7afaca2091b63c50ae8c9f5809bef9ec7e836db4 (patch) | |
tree | 4d537b77ad4e028c300f76a5496c4def7de24b65 /doc/classes/TileMap.xml | |
parent | 16228ba3e27b57df48256fcdf34670a25b3d52b0 (diff) |
Don't print error in get_cell_tile_data()
Diffstat (limited to 'doc/classes/TileMap.xml')
-rw-r--r-- | doc/classes/TileMap.xml | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 54eb83297d..72e74ff320 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -104,7 +104,8 @@ <param index="1" name="coords" type="Vector2i" /> <param index="2" name="use_proxies" type="bool" default="false" /> <description> - Returns the tile source ID of the cell on layer [param layer] at coordinates [param coords]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. + Returns the tile source ID of the cell on layer [param layer] at coordinates [param coords]. Returns [code]-1[/code] if the cell does not exist. + If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. </description> </method> <method name="get_cell_tile_data" qualifiers="const"> @@ -113,8 +114,17 @@ <param index="1" name="coords" type="Vector2i" /> <param index="2" name="use_proxies" type="bool" default="false" /> <description> - Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell is not a [TileSetAtlasSource]. + Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell does not exist or is not a [TileSetAtlasSource]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. + [codeblock] + func get_clicked_tile_power(): + var clicked_cell = tile_map.local_to_map(tile_map.get_local_mouse_position()) + var data = tile_map.get_cell_tile_data(0, clicked_cell) + if data: + return data.get_custom_data("power") + else: + return 0 + [/codeblock] </description> </method> <method name="get_coords_for_body_rid"> |