Pergunta

So I have a map which I have gotten the cells from and stored in a cell 2d array

Cells[][] cells;

My question is if I click one of the cells on the map, how do I get the cell that was clicked (X,Y).

Foi útil?

Solução

You do get the world coordinates form the clickevent. After that you calculate which tile it would be thats touched.
You take the x value of the touch devide it by the Tilesize same for y. After that you cast it to an integer and you do have the x,y values for the tile that is touched.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top