wasmercj – Magnet-arino

This assignment was about 5 times more difficult than Gaussian Pox. Reusing the code from the labs seemed like the best way to get things displaying on the screen. It was way more of a struggle than it should’ve been to get the first 2 rectangles displayed on the screen. Once we did, however, a lot of the other pieces just fell into place. Fixing the magnet pseudo-code was actually quite a challenge,  and I initially messed it up, causing the magnets to fly apart at 50 pixels per onDraw() call. Unfortunately coloring the rectangles inflated my code way more than it should have. When mutating the matrices for the rectangles, I wanted to pass in the direction as a variable instead of a literal, hard-coded “left” or “right”, that way i could change the variable when the magnet was flipped, which would’ve cut my onDraw() code in about half.

EDIT: added categories

Magnet1 Magnet2 Magnet3


Leave a Reply

Your email address will not be published. Required fields are marked *