Edit: Solved it! 
Hello!
Im making a a tile based game, and now im adding collision detection between player and a tile.
The collision works for only a small corner of the object and not the whole thing and i cant figure out how to fix it.
Player.java1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public int tile(float i){ return (int)Math.floor(i / 16 ); } public void update (int delta, Level level){ if(!level.solid(tile(x + + dx *delta), tile(y))) x += dx *delta; y += dy *delta; } |
Level.java1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public boolean solid(int x,int y){ if(x < 0 || x >= getMapWidth()) return true; if(y< 0 || y >= getMapHeight()) return true; if(data[x][y]==1) return true; return false; } |
So the player checks if the next tile is solid.. Its a txt based map

But as i said it only works with top left corner of the player and i cant figure out how to make the whole player(64x64)
Cheers! // Marrw
