I am currently making a 2D game, and I am in the process of making shadows. I have a buffered image background which is just a black rectangle to put over the screen, and a transparent triangle buffered image that will be used for the players viewed distance. What I want to do, is over my game draw the black background buffered image, and then where the player is, draw the transparent triangle and the black background does not show up inside this transparent triangle.
This might give you more insight on what I want to do:
Here is my shadow class:
private BufferedImage diamond;
private BufferedImage background;
public Shaders(World world) {
try {
diamond = ImageIO.read(getClass().getResourceAsStream("/GUI/DIAMOND.png"));
background = ImageIO.read(getClass().getResourceAsStream("/GUI/BACKGROUND.png"));
} catch (Exception ex) {
ex.printStackTrace();
}
this.world = world;
}
public void draw(Graphics g2) {
}