Your third assignment is the classic arcade game Breakout that will give you practice with graphics, events, animation and instance variables.

Getting Started

There is a starter project including all of these problems that you can access using the link below. Once you have the starter code set up, edit the program files so that the assignment actually does what it’s supposed to do (see the assignment handout), which will involve a cycle of coding, testing, and debugging until everything works. The final step is to submit your assignment.

This assignment may (optionally) be done in pairs. Be sure to check out the Pair Programming Handout if you decide to do so. As a reminder, you may only pair up with others with the same section time and location.

Note: In general, limit yourself to using Java syntax taught in lecture, and the parts of the textbook we have read, up through the week of the release of this assignment (July 11). You may, however, use material covered in class past this date for any optional extensions. If you would like to implement any extensions, please implement them in a separate file, such as Clearly comment at the top of this file what extensions you have implemented. Instructions on how to add files to the starter project are listed in the Eclipse page FAQ.

Assignment Files

Other Resources


Q: Why are my bricks the wrong size?
A: Are you using int sizes? Maybe you should use double for the highest precision. Also, are you sure your math is right? If there are 10 bricks per row, there are 9 gaps between them space at each side for centering. Also, are you sure you're using getWidth() and getHeight() to get the canvas size?
Q: Why can't I see the paddle?
A: Are you sure you're using the right values for the width/height of the overall game window? You should use getWidth() and getHeight() for this. Also try resizing the window larger to see if the paddle shows up.
Q: How many instance variables are ok to have? Can ___ be an instance variable?
A: We don't want to answer exactly what instance variables are okay or not okay. That is part of the assignment, for you to decide what is appropriate. You should follow the guidelines we have taught you for deciding that. If a value must be used through multiple methods over time and it can't be easily solved using a parameter or return, that is a good candidate for an instance variable. You should minimize the number of instance variables in your program and only use them if something truly needs to be an instance variable for the program to function.
Q: I'm having trouble getting Eclipse to work! Help!
A: Please make sure you followed the instructions in our Eclipse Guide above. If you are still having trouble, please come to Sarai or Laura's office hours, or stop by the LaIR.
Q: Eclipse is giving me a strange message about a file being "out of sync" with the file system. It says I can press F5 to refresh the file. What does this mean?
A: This happens if you edit/change your file outside of Eclipse. Just press F5 and Eclipse will show you the newest version of the file.
Q: I didn't like the program name, such as Snowman, so I renamed it to my own name such as DaveIsGreat. That is okay, right?
A: No. For grading purposes, we need you to leave the program names the way we named them.
Q: How do I turn in the assignment? How do I know if my submission was successful?
A: Please see the submitting assignments handout, also linked under the "Handouts" tab, for more information about submitting.
Q: Why doesn't my Java program say "[completed]" in the top status bar when it is done?
A: This is often because your program contains an infinite loop. Make sure all of your loops are terminating properly when your program is finished! Also see the debugging handout above for how to use the Eclipse debugger to track down and squash bugs.
Q: Will my solution get full credit? Is it written in the style you want? Will I get marked off for this code?
A: In general we cannot answer these kinds of questions. We call this "pre-grading." The section leader/TA/instructor can't look over your entire program for mistakes or tell you exactly what things you will get marked off for; we don't have the resources to provide such a service, and even if we did, we want you to learn how to gain these intuitions on your own. We'll grade you on the guidelines in the homework document and style guide, and we can help you with specific issues and questions about your code, but we cannot pre-evaluate your entire program for you or give you advance warning about every possible mistake or violation.