Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
CSE 341, Assignment 6: Space Invaders in Java CSE 341 Assignment 6: Space Invaders in Java Design due on Friday, 13-August-1999 Final version due on Wednesday, 18-August-1999 Demonstrations and grading on Friday, 20-August-1999 (See bottom for details on submitting) In this assignment, you will be designing and implementing in Java your own version of a now vintage video game called Space Invaders. You are provided with some code to start with in the form of an abstract base class, AnimationApplet. You are to work in groups of three. All three teammates will receive the same grade. The primary goals of this assignment are... to exercise object-oriented program design; to exercise implementing your design in Java; and to have fun extending the program in interesting, imaginative ways. the game The idea of Space Invaders is very simple, and you have probably seen the game before, but here is a brief description to refresh your memory: The player controls a ship which can move laterally (left and right) and shoot laser pulses or some other futuristic bullet equivalent at rows of alien monsters above which move back and forth while slowly descending toward the ship. The ship is destroyed (and the game thus ends) if any of the monsters reach the bottom of the screen (or, alternately, if any of the monsters crashes into the ship). Space Invaders and Galaxian are two examples of commercial implementations of this kind of game. the code Beyond the basic game design described above, the details are left up to you. This includes rules about how the aliens move, what kinds of aliens there are, whether the aliens can shoot back at you, etc. You are required (and will probably find it helpful) to extend a prewritten abstract class called AnimationApplet. This class is a general framework designed to make simple frame-by-frame animation easy to develop. You may not change the source code to this class. If you feel something needs to change that you cannot manage via subclassing, you must email Ken with your requested change---all changes to the class are at his discretion! Also note that we reserve the right to give you a new and improved implementation of this class, so you should rely only on its public interface. Source code for a sample class which extends AnimationApplet to animate a small, bouncing ball is also provided. Be sure to read the class documentation for these files: AnimationApplet.java AnimationSample.java Read the provided source code carefully and make sure you understand the basic structure of AnimationApplet before beginning your program design. Part of section tomorrow will be devoted to a walk-through of the provided code and discussion of when the Applet class' init(), start(), and stop() methods are called, as well as how a pair of threads are used to perform the animation. As you design your version of the game, keep in mind that good OO design is more important than flashy game features. Ideally, you'll end up with both: flashy features whose implementations greatly benefit from sophisticated class, interface, and class hierarchy design. There are parts of the given code which you are not expected to fully understand. This includes, for instance, the way the notify() and wait() methods are used and the various usages of the synchronized keyword. Web documentation exists on the following relevant topics for those who are interested in understanding the code more completely: class java.awt.Graphics collection classes, including the very useful Vector writing applets threads, including synchronization exception handling what to submit when By Friday, 13-Aug-1999, 10:55 a.m.: Email Ken (with subject line A6 design) a design, including the class hierarchy, for your game. Your design must specify the interfaces of the objects, and also demonstrate some thought as to relevant implementation details (e.g. instance variables). It is not sufficient to only describe each class and interface and the class hierarchy. You must also defend your design decisions, e.g. explaining why you chose to create a particular interface, to make one class extend another, to include instance(s) of one class in another, etc. Note that you are no longer required to explicitly discuss three extensions, as was specified in the preliminary version of this document. By Wednesday, 18-Aug-1999, lecture-time: Completed project including a short paper (2-3 pages) discussion your design (this will likely just be a revision and polishing of your email to Ken) and in particular, how you exploited object-oriented programming to make this game easier to write (or if it made it harder, explain why). You must hand-in hard-copies of the short paper, along with printouts of all the code. Also, you should turnin all the Java source code you wrote, but you should not eletronically submit your paper. On Friday afternoon, 20-Aug-1999: At least one member of your team (but ideally all three) will demonstrate your game to either Ken or Greg. A sign-up sheet will be passed around in class on Wednesday for your group to pick a ten minute slot sometime after the final exam. thoughts on an approach Keep your design simple---model your game after real-world (ok, game-world) objects (e.g., LaserShot, Meany, etc.) Get something working early---even if it is a really simple game with only two monsters that need to be shot. Think object-oriented---cutting and pasting code is probably a mistake, teach the game objects to respond to generic messages and use inheritance and overriding to refine the behaviours. Make expectations of your group members clear, and set deadlines for results. There's plenty of opportunity for bonus points, so have fun with interesting extensions! Back to the 341 home page... Last modified: Thu Aug 19 14:41:32 PDT 1999