- Apr 15, 2012
- 20
- 0
- 66
Hello! I am making a video game with some graphics off the net to test my mettle!
So my mettle has been tested and I am trying to animate a sprite using a sprite sheet. And my problem is trying to call the subImages.
So My Question is how to I call each subImage.
Playful Banter is allowed :sneaky:
This is in java! For the small of wit.
So my mettle has been tested and I am trying to animate a sprite using a sprite sheet. And my problem is trying to call the subImages.
Code:
public class Paladin {
BufferedImage AA = null; {
try {
AA = ImageIO.read(new File("Censored Location"));
} catch (IOException e) {
}
}
final int width = 96;
final int height = 95;
final int rows = 7;
final int cols = 9;
public BufferedImage[] sprites = new BufferedImage[rows * cols]; {
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
sprites[(i * cols) + j] = AA.getSubimage(
i * width,
j * height,
width,
height
);
}
}
}
}
So My Question is how to I call each subImage.
Playful Banter is allowed :sneaky:
This is in java! For the small of wit.