Alyssa's Week 6 Assignment

Project 6: Cityscape Take 2

By: Alyssa Belisle

21 March 2008

Task

The task was to create a city2.py file that was to hold all the functions for the new cityscape. Within in this file a building function was to be created that was to only have a scale factor, dx, along with x0 and y0. Therefore, everything in the building function, including the windows, door, and doorknob all have to be in terms of dx. Once the first building is created a second building function was to be created with the same parameters, but was to create a different building. Once these buildings were created and after every Zelle graphics object was used, at least one element of the scene was to be animated. Once complete, the demotest.py file was to be downloaded and run using our own city2.py file. This creates the first scene as seen below.


Loops, parameterization, and randomization.

I used for loops in order to draw, move, and clone my buildings, windows, and lights. By making a list that contained all the attributes of the buildings I was able to just iterate over elements of the list in order to manipulate the buildings. I used nested for loops in order to create and draw all the windows in just a few lines of code as opposed to coding seperately for each window. For loops were also used when creating the twelve lights that surround the billboard.

Parameterization was very useful. By only using the scale factor of dx throughout the entire program allowed for the buildings and other city elements to be drawn on any scale. Also, by creating a list for all the building elements and lights, a parameter could be deleted from each of the functions and therefore, less parameterization was needed in each function.

Randomization was used to primarily make changes to the visual aspects of the citscape. It was used for the building colors as well as for door and window colors, but it was also used when coding for animation. Using randomization when doing animation helped because it allowed the lights to flash and the windows to darken at random times instead of at set intervals.


Zelle graphics in the city.


Extensions

My extensions include the additional animation of the lights on the billboard as well as using randomness to create multi colored buildings and windows. I also created user input into the scene. The user must click in the window in order to create the sky, the sun, the billboard, and the lights to go around the billboard.

The Final Cityscape

Back to homepage