Hello
Im having touble trying to display an isometric map portion (The diamond that covers all the visible screen) on the screen. I dont really know why is wrong with my code.
Can somebody help, please.
This is the code im using for the map builder:
public pruebaGM(int ancho, int alto, int mosx, int mosy, int a[][], Applet p){
//Applet padre
padre = p;
//Medidas del padre
pantancho = ancho;
pantalto = alto;
//Creacion de mosaico modelo
prototipo = new Mosaico(0, p);
//Medidas de mosaico modelo
mosancho = prototipo.ancho;
mosalto = prototipo.alto;
//Mitad de las medidas para puntos de referencia
mosanchoMT = (mosancho/2)-1;
mosaltoMT = mosalto/2;
//Mosaicos visibles segun tamano de la pantalla
mosavis = Math.round(pantancho*2/mosancho);
//mosavisy = Math.round((pantalto*2)/mosaltoMT);
//Referencia para centralizar mapa
offsetH = Math.round(pantancho/2-mosanchoMT);
//offsetV = Math.round((pantalto-(mosavisy*mosalto))/2);
//Mitad de los mosaicos visibles
mosavisMT = Math.round(mosavis/2);
//mosavisyMT = Math.round(mosavisy/2);
//Mosaicos de definicion de boundaries
mosaX1 = mosx-mosavisMT;
mosaX2 = mosx+mosavisMT;
mosaY1 = mosy-mosavisMT;
mosaY2 = mosy+mosavisMT;
//Lienzo donde sera plasmado el mapa
grid = new BufferedImage(ancho, alto, BufferedImage.TRANSLUCENT);
//Creando interfaz grafica
pintor = grid.createGraphics();
//Buffer para registro de mosaico visible
mosanum = 0;
System.out.println("Eje de X: "+mosaX1+"-"+mosaX2);
System.out.println("Eje de Y: "+mosaY1+"-"+mosaY2);
//Bucle de construccion
for(int i=mosaX1; i<mosaX2; i++){
for(int j=mosaY1; j<mosaY2; j++){
try{
System.out.println(i);
mosagrid = new Mosaico[mosavis*2];
mosagrid[mosanum] = new Mosaico(a[i][j], p);
mosagrid[mosanum].posX = ((j*mosanchoMT)-(i*mosanchoMT))+offsetH;
mosagrid[mosanum].posY = ((j*mosaltoMT)+(i*mosaltoMT));//+offsetV;
mosagrid[mosanum].paint(pintor);
mosanum++;
}catch(Exception ex){}
}
}
}