Lab Assignment 2

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

-Kevin Bennett-

The assignment was to create two classic-type outdoor scenes using simple shape functions as building blocks. I decided to include a house function, a tree function, a car function, and a rain function. The house consists of a square block and a triangle roof on top with a rectangle door and two square windows. It was difficult at first to get the color right, but I quickly decided against a trial-and-error method and instead just looked up the RGB values on a website. The tree function has a rectangle as the trunk and a jagged pine tree-looking part as the leaves. I had to reach way back into the recesses of my memory to recall basic trigonometry to decide how long to make each part of the tree/ what angles to use, but I got it pretty quickly. Each of the shapes also had a size parameter as well.
Here is the first scene, using those two functions:


The car is just drawn out, not using any previously-defined functions, and it has black circles as wheels. The rain is just 200 2-pixel radius circles that I spaced around using the random module between -500 and 500 for the x-value and -150 and 500 for the y-value. The second scene uses the house function, the car function, and the rain function. Here it is:

I had to try some trial-and-error work with the random module since I didn't really understand it at first, but I got it before too long.
The code files are where they should be, I believe.