Tilemap position (Solved)

Hi,
For my 2D platformer game I am adding powerup blocks that change texture when the player hits the bottom of the block. This part is working but I am having trouble differentiating between which block has been hit. I am using the function message.other_position to determine the position of the object my player has collided with but for every block this is returning the vector (0,0,0) is there any way to determine the position of a tile from a tilemap?

This will return the position is the tilemap component, not the tile itself. Use the player position and calculate which tile it is by dividing by tile width and height.

2 Likes

Thank you. Is the player position from the bottom left of the player?

The player position is the position of the game object. The sprite may be positioned offset from the game object position so you need to account for that.

1 Like