private void saveAll()
  {
      try{ 
      FileOutputStream saveFile = new FileOutputStream("save.sav");
      
      ObjectOutputStream save = new ObjectOutputStream(saveFile);
      
      ArrayList<SaveVariables> lowerVar = new ArrayList<SaveVariables>();
      ArrayList<SaveVariables> middleVar = new ArrayList<SaveVariables>();
      ArrayList<SaveVariables> invVar = new ArrayList<SaveVariables>();
      ArrayList<SaveVariables> enemyVar = new ArrayList<SaveVariables>();
      
      SaveVariables newPlayer = new SaveVariables(player.getCoords().getX(), player.getCoords().getY(), player.getLife());
      for (Coords coords: lowerLayers.keySet()) {      
      SaveVariables newItem = new SaveVariables(coords.getX(), coords.getY(), lowerLayers.get(coords).getType());      
      lowerVar.add(newItem);
      }
      for (Coords coords: middleLayers.keySet()) {
      SaveVariables newItem = new SaveVariables(coords.getX(), coords.getY(), middleLayers.get(coords).getType());      
      middleVar.add(newItem);
      }
      for (Inventory inventory : inventorys) {
          SaveVariables newItem = new SaveVariables(inventory.getItemCode(), inventory.getQuantity(), 0);
          invVar.add(newItem);
      }
      for (Coords coords: enemyLayers.keySet()) {
          SaveVariables newItem = new SaveVariables(coords.getX(), coords.getY(), enemyLayers.get(coords).type);
          enemyVar.add(newItem);
      }
      save.writeObject(lowerVar);
      save.writeObject(middleVar);
      save.writeObject(invVar);
      save.writeObject(enemyVar);
      save.writeObject(newPlayer);
      save.writeObject(equipped);
      save.writeObject(xLLimit);
      save.writeObject(xRLimit);
      save.writeObject(yULimit);
      save.writeObject(yDLimit);

      save.close();
      }
      catch(Exception ex){
          ex.printStackTrace();
      }
      
  }