Indoor Fort Building

Building a Virtual Fort 


Sometimes there just isn't any snow, branches, leaves, or many natural materials for one to build a fort out of. Since I was not doing this blog when there was plenty of snow around, and also my model building/crafting skills are pretty abysmal, I decided to build a virtual fort, using the VPython software our class used to do summer homework. Using a series of rectangular "bricks" I built a fort that could sit on the ground and protect a person from the elements.  

The red "brick" areas represent the bottom and the top of the fort, while the blue "brick" areas represent the sides, and the green "brick" area would be the back of the fort.  













Here is the code I used to build this fort. While it looks like a lot, most of the objects are the same with a simple position change.  Using a coordinate system, the bricks are "stacked" from 0-5, or from -5 - 5 depending on their position.  For example, the blue bricks are stacked with the same varying z coordinates (-5 to 5), but with a different x coordinate for the different sides. 




from visual import*
box(pos = (0,0,5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,5,5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,4,5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,3,5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,2,5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,1,5), axis = (5,0,0,), length = 10, color = color.red)

box(pos = (0,0,-5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,5,-5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,4,-5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,3,-5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,2,-5), axis = (5,0,0,), length = 10, color = color.red)
box(pos = (0,1,-5), axis = (5,0,0,), length = 10, color = color.red)

box(pos = (5,0,5), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,4), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,3), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,2), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,1), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,0), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,-1), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,-2), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,-3), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,-4), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (5,0,-5), axis = (0,5,0), length = 10, color = color.blue)

box(pos = (-5,0,5), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,4), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,3), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,2), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,1), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,0), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,-1), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,-2), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,-3), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,-4), axis = (0,5,0), length = 10, color = color.blue)
box(pos = (-5,0,-5), axis = (0,5,0), length = 10, color = color.blue)

box(pos = (0,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (5,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (4,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (3,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (2,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (1,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (-1,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (-2,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (-3,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (-4,0,0), axis = (0,0,5), length = 10, color = color.green)
box(pos = (-5,0,0), axis = (0,0,5), length = 10, color = color.green)







Comments

Popular Posts