Project 6: Animated Cityscape
The purpose of this project is to give you experience with both top-down design and efficient coding practices that take advantage of things wil similar structures.
The result of this assignment will be similar to project 3. You'll have a couple of scenes that are collections of complex objects. The complex objects will all be collections of Zelle graphics primitives and have the same organization as the clubhouse you created in lab.
The difference is that your final scenes in this project can be animated, with objects moving or changing colors.
Think about a cityscape you want to create. Design the scene on paper
as a collection of complex objects like buildings, streets,
stoplights, and cars. Keep it simple. Come up with at least 2
new complex objects that you want to create for your scene.
For each of the complex objects, create a new file that contains an init and animate function for that object. Name them as we did in lab with the clubhouse. If your object is a car, name the functions carInit and carAnimate.
The init function should always take an x, y, and scale, which you should use just as in project 3 so that the object can be placed anywhere at any scale. The init function should return a list of the primitive objects that make up the complex object, just like we did with the clubhouse.
The animate function does not have to do anything (just put a return statement in it). But you ned to animate at least one of your new complex objects, even if it means just changing colors. The animate function has to take in at least one parameter, which is the list of primitive objects. You can add any other parameters as necessary.
Each complex object file should have a main function for testing purposes that creates a window, creates multiple versions of the complex object and then waits for a mouse click to quit. If your animate function does something interesting, test that out as well. Include small picture from each complex object in your writeup.
Have step 1 written and tested before labs on the 17th and 18th
Make a file scene.py that contains the functions sceneInit, sceneDraw,
and sceneAnimate. The sceneInit function should be structured like the
other complex objects with x, y and scale as parameters. A scene
should contain only complex objects, however, no Zelle graphics
When you create a complex object, you need to add it to the scenelist of objects as a duple, as given below using the clubhouse as an example.
scenelist =  obj = clubhouse.clubhouseInit( x, y, scale ) scenelist.append( ( 'clubhouse', obj ) ) obj = clubhouse.clubhouseInit( x + 100*scale, y, scale ) scenelist.append( ( 'clubhouse', obj ) )
Note that the duple contains the name of the complex object as the first value and the object list as the second value.
The sceneDraw function should take in a scenelist and a window, loop over the scenelist of duples and call aggregate.draw on the second item in each duple. Use print statements if you aren't clear on what the various variables contain.
The sceneAnimate function should take in a scenelist, loop over the scenelist of duples and use the string in the first position of the duple to figure out which animate function to call.
Include a picture of your scene in your writeup.
Create a new python file scene2.py. Write a main program that creates
at least two copies of your scene from the previous step at different
scales and locations. The program should then enter a loop and animate
all of the scenes.
Include a picture of your scene collection in your writeup.
- Do something creative within this framework. Include a picture in your writeup.
- Create a clone function in aggregate.py that works for the complex objects. It should create a complete copy of the complex object list. Demonstrate the clone function in one of your test functions or the sceneInit function.
- Use command line arguments to control aspects of your scene.
- Make additional complex objects beyond the required 2-3.
- Following the idea of the dynamic collage, set up a system that creates a scene out of complex objects based on a list that gives the name, location, and scale of each complex object in the scene.
- Figure out how to call the animate function for the proper kind of object without using an if/elif control structure.
Make a new wiki page for your assignment. Give the page a useful title using English words (cs151s10proj6 is not a useful title). Put the label cs151s10proj6 on the page. Each of you needs to make your own writeup.
In addition to making the wiki page writeup, put the python files you wrote on the Academics server in your handin directory.
In general, your writeup should follow the outline below.
- A brief summary of the task, in your own words. This should be no more than a few sentences. Give the reader context and identify the key purpose of the assignment.
- A description of your solution to the tasks, including any images you created. This should be a description of the form and functionality of your final code. You may want to incorporate code snippets in your description to point out relevant features. Note any unique computational solutions you developed.
- A description of any extensions you undertook, including images demonstrating those extensions. If you added any modules, functions, or other design components, note their structure and the algorithms you used.
- A brief description (1-3 sentences) of what you learned.
- Don't forget to label your writeup so that it appears in the listing on the main wiki page for the course. For this lab, use cs151s10proj6