how to get ground postion, no matter where your player is standing.
2d array: (0=sky, 1=ground, 2=player)
0001 2011 1111
so to get ground position i do this.
int map_height = a.length * tile_size; int on_ground = map_height - tile_size;
problem with above code is that it will only get me the last row postion and thats the ground postion. it wont take in count the ground above it.
so i did this in a loop. i am not sure what to do in if statment so it will give me ground postion, no matter where is player is standing.
for(int y = 0; y < a.length; y++) { for(int x = 0; x < a[y].length; x++) { if(a[y][x] == 1) { on_ground = map_height - (tile_size * ) } } } }