public void initialize() {
        //finding out number of possible tiles
        File tilelist;
        try {
            tilelist = new File(getClass().getResource("resources/tiles.txt").toURI());
        } catch(URISyntaxException e) {
            tilelist = new File(getClass().getResource("resources/tiles.txt").getPath());
        }

        int tilelength = 0;
        Scanner scan;
        try {
            scan = new Scanner(tilelist);
            while (scan.hasNextLine()) {
                if (!(scan.nextLine()).isEmpty()) {
                    tilelength++;
                }
            }
            scan.close();

        } catch (FileNotFoundException e1) {
            System.out.println("Tile declarations not found");
        }
        //setting image array size to number of tiles
        baseimages = new Image[tilelength];
        for (int i = 0; i < tilelength; i++) {
            try {
                baseimages[i] = ImageIO.read(getClass().getResource("resources/" + i + ".png"));
            } catch (Exception e) {
                System.out.println("Image not found");
            }
        }

    }