12345678910111213141516171819 |
- public class BlockTextures {
- private PImage terrain;
- private HashMap<Integer, PImage> sprites;
- public BlockTextures() {
- terrain = loadImage("terrain.png");
- sprites = new HashMap<Integer, PImage>();
- for (int row = 0; row < 16; row++) {
- for (int column = 0; column < 16; column++) {
- sprites.put((16*row)+column, terrain.get(column*16, row*16, 16, 16));
- }
- }
- }
- public PImage get(int id) {
- return sprites.get(id);
- }
- }
|