Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist

LarsBergqvist/player.gd

Last active Feb 18, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.