Tile Engine: Entity location wrong
- by Trizicus
I've made a tile engine that has 30px by 30px. I've ran into a problem with an object for example.
I've loaded an object 20px by 20px and when I do a collision check I have to use x/y position which is top left in Java2D. How can I do collision detection based on the entire object?
This is relevant code:
boolean checkCol() {
int currentGridX = ship.getX()/30;
int currentGridY = ship.getY()/30;
if(test[currentGridX][currentGridY] == 0)
return true;
System.out.println("collision");
return false;
}