Spray Paint

This was the first computer science project assigned to us in the class. The background is an image of a wall, the spray paint had to be able to switch between two colors, with the can changing to indicate the selected color. The two colors I picked were red and green. On holding the left mouse button, the can would spray the appropriate color as a small circle in a semi-random area where the mouse is with the appropriate sound effect.

For this project, I was the sole programmer responsible for it.

I learned about how to add sound effects, synch up sound effects to various actions and how to edit sound files using Audacity to allow the code to continuously replay the sound effect. I had to add a silent sound effect and play it, so that the other sound effects for the spray can didn’t play. I also learned about how to track the mouse position and continuously update the spray can image to follow the mouse. I also learned about how to place images in the z axis, by using pushToBack() and pullToFront() methods to place the background and spray can appropriately, allowing the spray can to cover the mouse cursor.

A video demonstration of the code is at https://www.youtube.com/watch?v=oSu5INOgcMo.