Skyline

This is an individual assignment.

Many complicated movie scenes that you see involve lots of individually generated objects, all assembled together on one screen. A computer generated movie scene of a city (such as in the Spiderman movies, for example) involves superimposing a number of buildings of different shapes and sizes. For this assignment, you will create a city by drawing a number of buildings of varied sizes.

Create a directory named skyline to store your work, then copy into it graphics.py. (For part 2, copy your directory and all code within to another directory called skyline2; that way, you don't clobber your first submission after you turn it in.) Create a class called Building (in a file called building.py) to represent a building in a city. Specifically, it should have the following methods:

Part 1


Part 2


You should add on your own any other instance variables that you need.

Draw your building by doing what you can to make a rectangle look building-like. Add an antenna to the top of the building whose height is proportional to the rest of the building. Draw windows running down and across the buildings. You don't need to go crazy making the width of the windows correct or anything like that: some attempt at making some kind of repeated pattern of windows should do the trick. Of course, feel free to get as fancy as you like after you get everything else working.

Test your code as you go along. Put your main function in a separate file called skyline.py, and include the code

from building import *

at the top of it. As you write methods in your Building class, test them in main in skyline.py.

When you are all done with Part 2, test your code against the skyline.py that I provide. If you have built your Building class correctly, this skyline.py program should generate an awesome skyline for you to look at.

Note that even though skyline.py doesn't use all of the methods from part 1, your final submission for part 2 should have all of the methods from both part 1 and part 2 above.

Good luck, and have fun! Remember that lab assistants and prefects are available to help out if you need it.