Ok well i was playing around with images and attempted to create an isometric tile basically by rotating the image 45 degrees and scaling it’s y by 50%, sadly the original image would scale by half instead of when it is rotated, here is the code
package isometrictest;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.io.File;
import javax.imageio.ImageIO;
public class GUI extends JFrame{
Image tile;
JPanel pane;
public GUI(){
super("Isometric Test");
try{
tile = ImageIO.read(new File("C:/Users/Yosef/Documents/NetBeansProjects/isometricTest/grasstxt2.png"));
}catch(Exception ae){
ae.printStackTrace();
}
pane = new JPanel();
getContentPane().add(pane);
}
@Override
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
AffineTransform tf = new AffineTransform();
//AffineTransform tx = new AffineTransform();
tf.translate(300, 0);
tf.rotate(Math.toRadians(45));
tf.scale(1d, 0.5d);
g2.drawImage(tile, tf, pane);
}
}
And this is what is happening: