(0.0.0) Nesting Elements - JujuAdams/Bento GitHub Wiki

//Define our base box
box = bento_box_region(20, 20, room_width-20, room_height-20);
with(box) //Go into the scope of the box element
{
    //Create a child
    with(bento_box("90%", "90%")) //Now go into the child's scope
    {
        place("5%", "5%");
        style.fill.color = c_red;
        
        //And another child
        with(bento_box("90%", "90%")) //Scope change again
        {
            place("5%", "5%");
            style.fill.color = c_lime;
            
            //Add two more children!
            with(bento_box("40%", "40%"))
            {
                place("5%", "5%");
                style.fill.color = c_blue;
            }
            
            with(bento_box("40%", "40%"))
            {
                place("55%", "55%");
                style.fill.color = c_yellow;
            }
        }
    }
}