This weeks lab involved using conditionals, so I figured I would give another shot at my Chain Chomp.
I ran into difficulties initially because in order to handle rotation, processing does matrix multiplication to change your frame of reference. Thus, every object you rotate independent of one another would exist in its own little world. I was able to successfully rotate my first chain link (though not from a pivot point as I would like). I then extended the chain by having each link be translated along the relative x axis of the entire chain.
I originally wanted to include teeth for the Chain Chomp, but as I tried to add the triangles they did not hold the frame of reference like the other pieces. I would like to add behaviors in the future as well to the chain chomp, so that it waits a few seconds before lunging after the mouse.
I figured I would try to salvage my sketch with one more bell/whistle by adding a mario sprite that would run across the screen when the letter ‘m’ was pressed. While I succeeded in loading the image as well as moving it across the screen, I could not figure out how to get the image to switch back and forth between the two Mario running sprite images. I did learn that in Super Mario Bros 3 that Mario has a maximum running rate of 2.5 pixels per second. I also learned that there is plenty more to figure out in processing.
This weeks lesson brings the challenge of user defined functions, which should be enjoyable.