Wednesday, September 29, 2010
Homework 3: Completed
As you can see I now have 3 objects bouncing around the screen. The box goes side-to-side, the triangle goes up and down, and the "ball" (I chose a picture of my 1 year old son) bounces around all of the sides.
I've made quite a few changes since the last post. I went ahead and made a MovingObjects superclass and subclassed Box, Ball, and Triangle off of it. This prevented any code-reuse as most of the work is being done in the superclass and the subclasses are mostly just setting environment up.
I have a big aversion to putting any constants in my programs, so I created a MOProperties file that reads in all of the environment (Panel size, object velocities, FPS, etc).
The MovingObjects Panel class was based on the WormChasePanel class. In-fact it's really just a heavily modified copy of the WormChasePanel class, where I took out the irrelevant parts, and added a few pieces that I needed. The MovingObjects main class is also based on the WormChase class, again very heavily modified.
I wasn't really clear on the assignment so I didn't know if we needed to add in any transparency. As such, my triangle and "ball" have white space around them, which can be more easily seen when they overlap. I wasn't sure how to correct this, since we discussed it in class, but not how to actually do it.
Fun assignment, looking forward to working on space invaders.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment