Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Last active February 18, 2018 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/095cbde5c6fce69a6a548541d44c9e20 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/095cbde5c6fce69a6a548541d44c9e20 to your computer and use it in GitHub Desktop.
Godot: checking if the player character is on a particular tile (a ladder) in the tile map
var on_ladder = false
func _physics_process(delta):
var tilemap = get_parent().get_node("TileMap")
if not tilemap == null:
var map_pos = tilemap.world_to_map(position)
var id = tilemap.get_cellv(map_pos)
if id > -1:
if tilemap.get_tileset().tile_get_name(id) == "ladder":
on_ladder = true
else:
on_ladder = false
else:
on_ladder = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment