Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Asteroids java

dantheman
dantheman 


In this assignment you will complete the implementation of an Asteroids game. I have provided a partial implementation. If you wish, you may work with a partner. You may earn extra credit by impressing your grader with extensions that go beyond the minimum required. This assignment will be worth 150 points. (Only 100 points will show, but it will be weighted by 1.5.) In the main course schedule, you will find links to two files that you will need. P10.zip is the partial implementation that you will be extending. Asteroids.jar is a working version of the game. It is your job to extend the P10 project so that it behaves like the working version. Asteroids Begin by importing P10.zip into Eclipse and running the game, such as it is. This is what you should see: 1. It begins with a splash screen with four asteroids floating around the screen. 2. When you click the "Start Game" button, the game starts. A ship appears in the center of the screen. You can rotate the ship by using the left and right arrow buttons, but that's all. 3. Eventually, one of the asteroids will collide with the ship. The ship will disappear and the asteroid will split in two. In a few seconds, a new ship will appear. 4. After you have lost three ships, the game will end. Now copy Asteroids.jar to your computer. As long as you have Java installed, you should be able to run the complete game by double clicking on the jar file. You will see that the full game is quite a bit different. Most of the differences will be quite obvious, but I'll point some out here: 1.When a ship appears, you will be able to accelerate it in the direction it is pointing with the up-arrow key. There is a maximum speed to which a ship can accelerate. 2.You can fire bullets by pressing the space key. There can be at most eight bullets flying around at any given time. A bullet disappears when it hits something or when it has reached its maximum range. 3.There are three sizes of asteroids: large, medium, and small. When a large asteroid collides with a ship or a bullet, the asteroid splits into two medium asteroids. When a medium asteroid collides, it splits into two small asteroids. When a small asteroid collides, it disappears. 4.Notice the transient "dust" that appears briefly when an asteroid splits or disappears! 5. Notice the transient "debris" that appears briefly when the ship is hit. 6. The game score goes up by 20 points when a large asteroid splits, by 50 points when a medium asteroid splits, and by 100 points when a small asteroid disappears. 7. Small asteroids are faster than medium asteroids, which are faster than large asteroids. All three kinds of asteroids speed up as each new level is reached. 8. Ship rotation and thruster firing are much smoother in the complete game. My son insisted that the controls in the stripped-down game were unplayable, so I upgraded them. You should too! Implementation Once you understand how the full game differs from the partial implementation, your job is to complete the partial implementation. To do this, you will need to 1. Study the partial implementations. The Participant and Screen classes are the most complex, but the good news is that you do not need to understand how they work. You do, however, need to understand the services that they provide. 2. Create classes that represent bullets and debris. Look at the Ship and Asteroid classes for inspiration. Notice that both of those classes extend Participant. Your Bullet and Debris classes should extend Participant as well. 3.Make modest modifications to the Game class 4.Make extensive modifications to the Controller class. Be sure that you take note of how it uses CountdownTimers and TransitionTimers. You'll need to use those too. 5.The Constants class contains a number of constants that I use throughout my complete program. 6.The only existing classes you will need to modify are Game and Controller. You will notice that there are lots of comments in my partial implementation. I expect you to document your work in the same fashion. Extra Credit You can earn extra credit by making changes that go beyond the reference implementation. Credit will be awarded at the discretion of the grader, but more impressive extensions will be given more credit. Here are some ideas, but don't let this list limit your ambitions: [10 points] Allow the player to earn extra lives when he or she reaches certain scoring thresholds. [10 points] Keep track of and display a high score to date. [10 points] Add a teleport control that will instantly move the ship to a random spot on the screen. [20 points] Incorporate sound effects. Sound is what drew me away from the pinball machines and over to the newfangled video games in the 1980s. Play and listen to http://www.play.vg/games/4-Asteroids.html. [40 points] The original arcade game (play http://www.play.vg/games/4-Asteroids.html again) had two different kinds of alien ships that would periodically fly across the screen, shooting bullets. One kind of ship would fly and shoot poorly; the other would fly and fire adroitly. Have fun! Turning In To hand this in, export the complete project into a zip file and then upload that file. To do this in Eclipse: Right click on the P10 project and choose "Export..." Expand "General" and Double click on "Archive File" Make sure that P10 is clicked, enter a file name, and click "Finish". Before submitting the file, make sure that you can import your zip file back into Eclipse and make sure that it works properly when you do! If you did any work that you want to have considered for extra credit, also submit a file called "extra.txt" that explains what extra features you implemented. If you worked with a partner, only one of you needs to submit P10.zip and extra.txt. However, both of you should submit a file called "partner.txt" that identifies your partner. To submit your files, use the control below. Attachments Tags Clarifications

Answers