@Override
	public HashMap<String, Level> loadAll() {
		//Create hashmap of levels
		HashMap<String, Level> levels = new HashMap<String, Level>();
		
		//for each file in the directory which has the proper extension
		for(File f : getDirectory().listFiles(
			new FilenameFilter(){

				@Override
				public boolean accept(File arg0, String arg1) {
					return arg1.endsWith(ext);
				}
					
			}
		)){
			//Store the filename
			String fileName = f.getName();
			//Create key for hashmap
			String key = fileName.substring(0, fileName.length() - ext.length());
			
			//Declare image to load level from
			BufferedImage levelPicture;
			
			//Try to loadimage
			try {
				levelPicture = ImageIO.read(f);
			} catch(IOException e) {
				//If shit goes down, print error
				e.printStackTrace();
				System.out.println(e.getMessage());
				levelPicture = null;
				
				//Move to next file
				continue;
			}
			
			//Create level
			Level thisLevel = new Level();
			
			//Get level width and height and num pixels
			int width = levelPicture.getWidth();
			int height = levelPicture.getHeight();
			
						
			//Set variables to help build game objects out of pixels
			boolean spanningObject = false;
			int indexObjStart = 0;
			Color previousColor = Color.white;
			
			//For each row of pixels
			for(int i = 0; i < height; i++){
				//For each column of pixels
				for(int j = 0; j < width; j++){
					Color c = new Color(levelPicture.getRGB(i, j));
					
					//If the color is white
					if(c.equals(Color.white)){
						if(!previousColor.equals(Color.white)){
							//Create object
							thisLevel.addObject(makeObject(i, indexObjStart, j, previousColor));
						}
					}
					else if(!previousColor.equals(c)){
						if(!previousColor.equals(Color.white)){
							thisLevel.addObject(makeObject(i, indexObjStart, j, previousColor));
						}
						
						indexObjStart =j;
						
					}	
					previousColor = c;
				}
				if(!previousColor.equals(Color.white)){
					thisLevel.addObject(makeObject(i, indexObjStart, width, previousColor));
				}
				previousColor = Color.white;
			}
			//Optimize the level
			thisLevel.optimize();
			
			//Add level to hashmap
			levels.put(key, thisLevel);
		}
		
		return levels;
	}