Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ArAdev | |
Old Version | Published before Godot 3 was released. |
Hi, I´m trying to get the position of a tile inside a tile map to later set the cell to -1. The problem is that I can´t get the pos. I´m using a sprite to try to get the position. I can set a cell to -1 with set_cell() if I have the position before, but I need to delete the tile in-game when the sprite “collides” with it (get the same pos).
I tried using something like this:
var tile = self.get_cell(self.world_to_map(sprite.get_global_pos()))
But it says that the engine expects two arguments. How can I solve the problem? Thanks in anticipation.
Method get_cell() wants the x and y as separate not as one vector2.
Hooni | 2017-12-17 19:27
Yes, I know that, but I don`t know how to get the position on the tile map of the tiles (not the global position in the game)
ArAdev | 2017-12-17 20:10
Do you mean that you don’t know how to get the x and y components from your world_to_map(sprite.get_global_pos())
? You just add .x to get the x component and after a comma add the same thing for the y.
God damn I hate typing on mobile…
Hooni | 2017-12-17 20:37
Thanks a lot, it worked!. I was having too much problems with this.
ArAdev | 2017-12-17 20:52