Non calcolo niente di preciso. E' conseguenza del metodo paint che scorre una matrice e disegna di conseguenza in base al suo contenuto.
codice:
public void paint(Graphics g) {
super.paint(g);
for (int y = 0; y < dim; y++) {
for (int x = 0; x < dim; x++) {
if (m.getMap(x, y) == 3) {
g.drawImage(m.getFinish(), x * 15, y * 15, null);
}
if (m.getMap(x, y) == 0) {
g.drawImage(m.getGrass(), x * 15, y * 15, null);
}
if (m.getMap(x, y) == 1) {
g.drawImage(m.getWall(), x * 15, y * 15, null);
}
}
}
g.drawImage(p.getPlayer(), p.getTileX() * 15, p.getTileY() * 15, null);
}