take and build a 2X4 Rectangle 1" shorter than the wall its going ons length, and as wide as you need it to be,then place 1/2 or 3/4 inch ply over 1 side. (make sure you make it smaller than the side of a shanty.....a little bit off and it will get stuck) Then take and cut 4 pieces of 2X4 and attach them to the walls in the 4 corners of where you want the bench to Lay on. this is to support the bench's weight with you on it and mounts out of the way along the outter walls, attach to outter walls it only has to be attached enough to be upright, the external wall shouldnt not have any weight on it.....Some people use hinges to swing the bench up out of place, however, if you do this you limit adding padding to it. so intead use padding that can be removed. use 2 hingesone about a foot from each end, and add a hook and eye lock like this to hold it in place when its upright.....use more than 1 so it doesnt accidently come down.
http://www.kiddieproofers.com/items/kiddie%20proofers%20046.jpgfirst measure and attach all 2X4s to the outter wall where the corners of the box will rest. then set the frame you made with the plywood attached on it. snug it to the wall but allow the ends to not touch either side. rotate it up w/o hinges to make sure it will go without snagging the sides. if it will, lower it back, snug it to wall and install hinges to the top of the plywood and the sidewall still visible. Make sure and use some Decent size hinges. after the hinges are attached with 1 screw in each side of hinge both hinges, test it using 2 people (to keep it square)to make sure your bed hasnt shifted. if everything is still good, lower it down and add remaining screws. Fold it back up along wall and while 2nd person is hold it against wall, mount 2 or 3 hook and eye locks. Project is completed outside of padding.
Hope you can visualize what i tried to explain. If not tell me what you dont understand and i'll try and explain it better/differently.