For week two, the assignment was to either take the original drawing from week 1 or make a new drawing and add both interactivity and variables. Variables allow for a much easier time when changing values on the fly. For example, if I want 100 squares all the same size but I then decide that the square size should be 50×50 instead of 20×20. Instead of replacing each individual value in all of the squares, I can just change the value of the variable “squaresize” and anywhere that “squaresize” is located, the value will be equivalent to whatever I set it.
My original idea (and still a pending idea) was to draw a Chain Chomp, but the relative rotational mechanics (as opposed to global rotation around the origin) for even one chainlink was a bit of a trigonometric headache. This will be tackled in the future.
Instead I started with one type of clock. As the time gets closer to being full (out of 60 for seconds and minutes, 24 hours for hours (ie military time), the arc increases in length. I then decided to add two more varieties of clock, one with circles rotating a makeshift coordinate system, and the other with bars that slowly fill the screen from top to bottom. Pressing any key on the keypad will allow you to cycle through the variety of clocks, and pressing the mouse button will allow you to cycle through the color schemes (dark, normal, and light).
The background is that color blue because I planned to add a fish in that followed the mouse cursor, but same trig headache as the chainlinks (though simplified for two identically behaving objects instead of the chaos the chain would be). I will solve the trig headache and soon.
I present, The Clocks
Also, while I may feature code snippets or entire projects from time to time, the final source code is available at the bottom of those links for those that are interested. I think I may start leaving out most of my code therefore for this type of post.
Next week (ie tomorrow) = logic and conditional statements. Hooray my philosophy degree will come in handy! I have a few of these already in this weeks code, but hopefully I will think of something off the wall for next weeks project.