Hi there,
I’m having trouble at the moment detecting the tiles around a specific tile. I’m doing this so that I can auto texture the tiles with their correct sides. Anyways, I have a get method in my level class that does the following:
public Tile get(int x, int y){
return tiles[x][y]; //Tiles is a Tile array.
}
When printing out tile.getPosition().x, it returns a float value, which is correct due to it being a Vector. So, 1.0 for example. I need to check the tile beside it, so I’m assuming I would do the following:
int x = (int) tile.getPosition().x + 1;
Unfortunately, this equals = 1.01. Why is this the case? How can I achieve 1.0 + 1 = 2.0? If I do 1.0 + 1.0, it will equal 1.01.0 oddly enough…
Thanks!
- A