Pygame Animation

Summary

The Pygame Animation is an animation created on Pygame, a library of Python. The animation was for a culminating project for my ICS2O1 (Introduction to Computer Studies, Grade 10) course, which therein introduced Python and PyGame. Using the topics that was taught during the course, I created an animation using if-statements and variables.

Inspiration

During March 2021, an American rapper named DaBaby in Minecraft was trending, which comprised of TikTok videos of:


Creation

A storyboard was created to plan the animation.

The program itself relies on many variables (e.g. ones partaining to time, scene, image position) and if statements. It starts with the scene number being 0, then in that statement, various actions are done (such as render "Steve goes mining" or the background colour). Most importantly, we pause the program for some time so that the viewer has enough time to understand the starting frame.

Once the pause function is exhausted, the first scene is shown. The program draws shapes like clouds in specific locations, as well as moves an image of Steve. That image is defined in variable image2X and each time the scene renders, variable image2X increases by a sum of 20. This, in return, moves Steve by 20 units. Steve, the trees, and grass blocks are a photo (i.e. not drawn directly by the program).

The code is rinsed and repeated, with each function acting like that until the animation is done.

Problems

I encountered many problems when creating the animation- most of them being logicial errors. For example, I had issues with the program not wanting to go to the next scene, later fixed by defining a new value to variable scene.

Additionally, I had some issue with the formatting of the program. The teacher wanted us to organize our code, but since the program was so complex, it would be really hard to organize this much code in such little time. I tried following his standards, but unfourntately due to lack of time, I had to forgo that standard near the end of the animation.

Finally, I had issue with closing the animation. The teacher did provide the code to close the animation using the escape key or the top right "X" close button, but it didn't work- most likely due to an logical error. Again, I had little time and had to forgo this. To close the animation, open task manager and kill the process.

If I had to do it again...

If I had to do this project again, I would better plan my animation with more detail and organize my code. A project like this magnitude is extremely complex, and it is very easy to get lost with the code. Unfourntately, I had a short timeframe of 2 weeks to finish this project- if I had more time, I would pay more attention to these issues. But when you have two weeks, you need to apply the cost-benefit analysis (with the cost being time, and the benefit being if this function works) to better prioritize things that need to be done.

Instructions to operate

For Windows 10 using PyCharm. Refer to other sources for other operating systems or integrated development environments.

Card image cap
PyGame Animation

DATE

June 2021

FOR

ICS2O1 Culminating

VIEW