This lab was our first introduction to animation and how we can accomplish this in python.
Our single task for this project was to create a scene that utilizes animation and complex objects. I decided to create a scene that has a vampire hunter theme. One "stumbles" onto a dark cave with vampire bats inside. When one switches on their light (by clicking the flashlight), the vampire bats try to fly away. The user can then try and shoot down them down using his pointer and clicking on the bats' chests. A vampire bat flies at random speeds, appears at a random spot on the in the cave, and flies in random directions back and forth upward. Keep in mind there is 75 bats, creating a pretty challenging game. All the randomization was done by using random.randit(); each complex object has a corresponding 'init" function, and if needed an "animate" function.
Here is a picture for each complex object in my project:
Here is a .gif of my project, however for a better video of this go to the below youtube link:
Because it is hard to read, this is what my program says at the beginning (along with what happens when you shoot) and end within the python window:
Make additional complex objects beyond the required 2-3.
By looking above, you can see that I created three complex objects (cave, flashlight, and vampire bat). Each was unique in its own way. The cave had to be stationary and take up the entire bot part of scene. I used the graphics Polygon functions to accomplish that. The flashlight was a partially stationary object, with the switch requiring its own _init and _animate functions. Also the turning on of the flashlight required its own _init and _animate functions as well. The most complex object was the bat, for it was 5 shapes (2 wings, 2 eyes, and main body) all having to move together. This required the inputting of random.randint functions throughout the function to draw one single bat.
Use a Python language feature new to you (not just a new library feature or function)
I decided to really push my self and integrate the use of user "clicking" to my project. This used language that I had to familiarize myself with and became a huge undertaking. Here is the programming that I used (yes I know this is alot, but it is relatively complex).
What I Learned:
I learned that python is able to make animations and to that end, has the possibility to make very complex ones. Also, I learned how to incorporate the user's "clicking" into a python and to make their "clicks" change the resulting animation.
And I made a game where you shoot vampire bats.
I had help from Dale and Kyle, and helped Toni Atkinson and Mike Wincek develop this "clicking" game mode within their own extensions.