For my animation final, I set out to create a mountain scene complete with shrubbery and hungry mountain goats. The mountain goats were to roam the mountain, head towards the plants, and when the plants ran out they would eat the mountain itself.
I first created a simple processing sketch trying to explore the concepts of periodic increased size (to show the mountain goats entering the screen), random distribution of objects akin to the shrubbery to be placed on the level, and minor experiments in motion. This first sketch is located here.
Next, I created the elements for my animation. I decided it would be easiest to animate the goats if they were separated into simple pieces including two part limbs, a body, a neck, and two parts to the head (upper and lower jaw). I traced an image of a mountain goat that I found online in illustrator, used photoshop to create and then saved the individual elements as separate layers in order to import them into after effects.
Within after effects, I created short 5 second behavior clips of the goat reaching down and chewing on the plants, as well as a short walk cycle. In order to best interact with processing including image processing, reactivity, and the ability to switch between the different movie clips, I exported the animated scenes as a collection of PNG images. While I animated in a 720 x 540 window (owing to the diminished capabilities of processing) I exported the mountain goat segments sized to 240 x 180. I knew that my goats would be smaller if anything, so I was not worried about losing quality.
I created a simple background image of a single mountain that took up most of the frame. Since I eventually plan to project this project, I left a simple single color sky which will be removed in the future.
I then created a simple fan-like shaped shrub in illustrator again using textures I found online and adjusted with photoshop. The fan-like leaves were rotated back and forth in to give the whole scene a bit more of a playful and animated sprite feel.
I successfully added randomly spawned moving shrubbery on top of the illustrated mountain background, but the mountain goat refused to behave in anything resembling a civil manner. Both animated loops agreed to play and I also in early version implemented a simple mouse click to switch between walking and eating. I then set it so that if the goat is walking and collides with a plant (all plant locations being set at the beginning of the sketch are also saved in an arraylist to track their future locations). I began a rudimentary goal-oriented behavior to direct the mountain goat towards the plant which was closest to him, and this is where the trouble began. The goat initially got confused in which direction he was headed, always traveling in a positive x direction away from the plants. Using arctangent limits the range of radian angles generated from Pi to -PI, ensuring that the cosine and consequently the x value would always be positive. Knowing this, I created a set of logic to direct the goat in the right direction depending on where he was in relation to the current closest plant, also resetting his behavior if along the way he came upon something even more near. However, I was unable to mirror the images, so it appeared that the mountain goat had a fondness for moonwalking. Attempts to reverse the pixel array ended in disaster, and the common option online to scale in the negative direction left me with a flickering ghost of a goat, flittering in and out like he was stuck in super position until he was able to eat owing to my use of Alpha channel enabled PNG files. He was able to gorge himself on plants in the end for the plants did not diminish in size nor disappear no matter the time dedicated to chewing on them, except for those few times where his journey led him without being near enough to taste.
Once this pair of issues is solved and the one goat behaves himself, I shall introduce several more goats to compete within the tiny environment. I was consistently weary during the process about the amount of resources hogged by the stream of images loaded, so in optimizing my code for the future I will attempt to mitigate the amount of times I run loops either through the pixel array, through the animation, or through various other arrays I have set up for tracking. Eventually this will also be projected initially onto a 2 dimensional mountain-outlined surface, but for now I desire to solve the minor issues I have faced.
The sketch is unable to work in Processing.js. Therefore I will show it in class on my computer (unless the java applet upload finishes succesfully).