package net.anyspieceofinter.unnamedgameproject.graphics; public class Sprite { public final int SIZE; private int x, y; public int[] pixels; private Spritesheet sheet; //sprites in enviroment sheet public static Sprite dirt = new Sprite(40, 0, 0, Spritesheet.enviroment); public static Sprite square = new Sprite(40, 1, 0, Spritesheet.enviroment); public Sprite(int size, int x, int y, Spritesheet sheet) { SIZE = size; this.x = x * size; this.y = y * size; pixels = new int[SIZE * SIZE]; this.sheet = sheet; load(); } private void load() { for(int y = 0; y < SIZE; y++) { for(int x = 0; x < SIZE; x++) { pixels[x + y * SIZE] = sheet.pixels[(x + this.x) + (y + this.y) * sheet.SIZE]; } } } }