So this week in ICM we learned about logic. Ifs, elses, if elses, and a few other handy ways to let the computer make decisions. Don’t worry, we’re far from AI territory, more like making a ball stop if it reaches the edge of the screen. I worked with Meghan to create a bouncy ball program, where we tried to make it seem like the ball was responding to gravity, as well as bouncing when it reached the bottom of the screen. Working with Meghan was helpful since she has more programming experience, and was very patient as I tried to understand the math behind acceleration.
We ended up making this:
You can also play with the actual applet here.
It was great trying to work with some if else statements, and I like the overall effect of what we made. However, after playing around with it a bit more, I realize that using the mouse to position the ball start location, but initializing with the L/R arrow keys, may not be the best control system. I wish we knew how to specify left / right mouseclick (there’s probably an easy way to look that up but I haven’t yet). In any case, it was a good lesson in trying to simulate gravity, acceleration, and ball dropping.