void updateHitboxes(Element frame)
{
    blue_hitboxes.clear();
    red_hitboxes.clear();
    
    boolean empty_red = false;
    boolean empty_blue = false;
    
    for(Node hitbox=frame.getFirstChild();hitbox!=null;hitbox=hitbox.getNextSibling())//Hitbox loop
    {
        if(hitbox.getNodeName().equals("Hitboxes"))
        {
            if(((Element)hitbox).getAttribute("variable").equals("red"))
            {
                empty_red=true;
                for(Node hitbox_red=hitbox.getFirstChild();hitbox_red!=null;hitbox_red=hitbox_red.getNextSibling())//Red Hitboxes loop
                {
                    //!!!
                    if(hitbox_red.getNodeName().equals("Hitbox"))
                    {
                        int x1 = Integer.parseInt(((Element)hitbox_red).getAttribute("x1"));
                        int y1 = Integer.parseInt(((Element)hitbox_red).getAttribute("y1"));
                        int x2 = Integer.parseInt(((Element)hitbox_red).getAttribute("x2"));
                        int y2 = Integer.parseInt(((Element)hitbox_red).getAttribute("y2"));
                        red_hitboxes.add(new Hitbox(x1, y1, x2, y2));
                        empty_red=false;
                    }
                }
            }
            if(((Element)hitbox).getAttribute("variable").equals("blue"))
            {
                empty_blue=true;
                for(Node hitbox_blue=hitbox.getFirstChild();hitbox_blue!=null;hitbox_blue=hitbox_blue.getNextSibling())//Blue Hitboxes loop
                {
                    if(hitbox_blue.getNodeName().equals("Hitbox"))
                    {
                        int x1 = Integer.parseInt(((Element)hitbox_blue).getAttribute("x1"));
                        int y1 = Integer.parseInt(((Element)hitbox_blue).getAttribute("y1"));
                        int x2 = Integer.parseInt(((Element)hitbox_blue).getAttribute("x2"));
                        int y2 = Integer.parseInt(((Element)hitbox_blue).getAttribute("y2"));
                        blue_hitboxes.add(new Hitbox(x1, y1, x2, y2));
                        empty_blue=false;
                    }
                }
            }
        }
    }
    
    drawHitboxes(empty_blue, empty_red);
    saveHitboxes();
}