Hi guys,
I made my own Sprite class, containing an ArrayList of subimages and a String “name”.
A class called FileManager creates all sprites and loads the images for the sprites like this:
Sprite blocks = new Sprite(null, "blocks");
blocks.frames.add(ImageIO.read(new File(imgD + "green_block.png")));
blocks.frames.add(ImageIO.read(new File(imgD + "red_block.png")));
blocks.frames.add(ImageIO.read(new File(imgD + "blue_block.png")));
blocks.frames.add(ImageIO.read(new File(imgD + "red_block.png")));
sprites.add(blocks);
I then load each image via fileManager.getSpriteByName(“name”);
But this is a lot of work since I have to load each frame seperately and name each sprite.
Is there any other, more “clever” way to do this? I didn’t come to a conclusion yet