문제

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).

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top