public BufferedImage getImage(String state, int frame, int dir)
	{
		// Try to get the state
		SpriteState st = states.get(state);
		if(st == null) return null;
		
		// Try to get the frame
		SpriteFrame fr;
		try
		{
			fr = st.frames.get(frame);
		} 
		catch(IndexOutOfBoundsException e)
		{
			// If the frame doesn't exist, try frame 0, that one must
			// always exist
			fr = st.frames.get(0);
		}
		
		BufferedImage b = fr.directions.get(dir);
		if(b == null)
		{
			// If the direction doesn't exist, try direction SOUTH,
			// that one must always exist
			b = fr.directions.get(Directions.SOUTH);
		}
		
		return b;
	}