In order to animate my complex objects, which are similar with those from project 3, I needed to import time and graphics libraries. Constructing complex objects was different from using turtle to draw objects because I set coordinates to build them instead of drawing line by line. Another big different between this project and project 3 was that I used list and its sub-indexes to move certain parts of the complex objects. Thus, I was able to not only animate the complex objects but also animate their specific parts.
As the insturction suggested, I created a "simple" car and "simple" stoplight to make up my scene (my complex objects were car and stoplight). My scene is simple as well. The stoplight will start with green light. Then the green light switches off, and yellow light switches on. Meanwhile the car is moving towards the stoplight. By the time, the red light switches on, the car stops. My complex objects look like below.
As you can see, my complex objects are made up of rectangles, traingles, and circles. I just needed to find approrpiate coordinates to create the complex objects. Moreover, I needed to calculate certain number of frames so that when red light switches on, the car stops.
The below shows the animation of car and stoplight.
- Make additional complex objects beyond the required 2, or animate more objects than the required one.
I created four other complex objects for this extension. One of them is a main spaceship; the three others are rockets. Below is the images of them.
Together, they look lie below.
These complex objects' scene is simple as well. They will move up as the spaceshs did in the lab. However, the three rockets will start to fall behind. In the end, the spaceship (the white one) only will continue to move up.
The file below is the animation of my extension scene.
As I mentioned in the abstrace, I used list slices to move certain parts of the complex objects differently. Although I justed for loop to animate the objects perhaps I could used other loops or methods to animate my complex object. In order to produce intended animation effects, I set different frame_number for each complex object. For example,
Constructing the complex objects were not so difficult thanks to my experience with turtle and project 3. The animation part of the project was more complicated. I needed to find a certain number of frames and time.sleep() to produce my intended animation effects.
Sources, imported libraries, and collaborators:
I imported time and graphics packages to draw and animate the complex objects. While working on this project, I received help from professor Skrien & Eaton and TAs during the lab. I did not use any outside source for this project.