0 votes

hi guys, i want to make my sprite snap to my tilemap map, but it wont snap when i use isometic, how should i do?
red box is my sprite, it snap like that
brown and green my tilemap
enter image description here
enter image description here

sprite node size x64 y32
tile size x64 y32
mode isometric

then i put this code:

func _unhandled_input(event: InputEvent) -> void:
    var tileNode       = get_node("TileMap")
    var mouse_cell_pos = tileNode.world_to_map( get_global_mouse_position() )
    get_node("TileTarget").global_position = tileNode.map_to_world(mouse_cell_pos) + tileNode.cell_size/2
in Engine by (390 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.