September 26, 2011
The purpose of this lab was to incorporate loops and conditional statement into my codes to create encapsulated codes and parameters to resize and position the scenes from lab2.
The first task was to rewrite functions from my shapes.py file from project 2. For my block function, window function, and triangle function, I rewrote all of the functions to include scales and for loops, and i also rewrote my block function and triangle function to include color.
I also rewrote my complex shapes from my first colby scene. For two different types of trees, I included scales and for loops.
After, I rewrote my entire Colby scene from project two. To do this, I had to redefine all of the simple and complex shapes to have scales. After, I copied my global function from the original colby scene to the compose1 file. I used this global function to be defined by a scene, with the parameters x,y, and scale. I converted the scene x and y parameters to be defined in terms of a starting location. This allowed me to convert my entire scene to scalable and movable.
three different versions of placing and sizing of my Colby scene.
Next, I created a new file that incorporated the Colby scene. I created a scene of a dorm room with a window view of my Colby scene.
This is an image of my Colby scene within another scene
Finally, I edited my compose2 scene to depend on a function parameter. I set up the program so that the window view depended on a command line argument. I set my scene x and y parameters to be composed of a certain x and y positions, which allowed me to move my window anywhere in my scene.
I used the command line argument to control another aspect of the scene. I used it to move my set of books along the desk.
I also demonstrated several levels of encapsulation. I created a new file and encapsulated a television. The scene shows a television within a television within another television.
Conclusion: I have learned how to utilize functions, loops, conditions, and parameters to manipulate the size and position of my scene.