COMP1022P Assignment: 3D Shooting Game BlueJ Java - 63696

Solution Posted by


Rating : (19)A+
Solution Detail
Price: $90.00
Request Description

COMP1022P Assignment: 3D Shooting Game


   Ready-to-use BlueJ

   Starting Project (original basic version)(This should be used to complete the basic requirements if you do not intend to implement any bonus feature that involves changing the game core source code.)

   Starting Project (includes the game core source code)(The game core involves some advanced concepts. Only use and self-learn about it when you need to implement some additional bonus features that require changing the game core source code.)


   Demo Program

   Demonstration schedule: May 8 (Thursday) and May 9 (Friday) lab sessions. You must attend your officially-enrolled lab session (LA1 or LA2) on one of those days for demonstration of your assignment work.

   Frequently Asked Questions (Last updated: May 2, 2:00pm)


You are going to complete a 3D shooting game for this assignment. In the game, the player will fire righteous bird bullets to kill the evil birds. 3D gaming can be experienced when the player wears a pair of 3D glasses.

Start of the game

At the beginning of the game, the player will first be asked for the game difficulty on the terminal:


Level 1 is the easiest level while level 3 is the hardest. The difficulty level affects how the targets (the evil birds) move. More details on it can be found in the corresponding method documentation. After entering the difficulty level, the player will see the \"game title\" screen on the canvas:


After a brief moment, the \"start game\" screen appears and signals that the game will start soon:


Then the player will be brought to the main game screen where the player has to control the cannon at the bottom to kill all the evil birds above it.


Main game screen

The player will be using the mouse to control the cannon. Moving the mouse horizontally will swing the cannon to the left or to the right. For example, when the player moves the mouse to the left on the screen, the cannon will swing to the left as follows:


On the other hand, if player moves the mouse to the right on the screen, the cannon will swing accordingly:


As the game world is 3D, you can also aim the cannon lower or higher. It can be controlled by moving the mouse vertically. For example, if you move the mouse toward the bottom of the screen, you can aim the cannon higher:


Now, after aiming the cannon at any of the targets (the evil birds in front of it), the player can click on the screen to fire the bullet (the righteous bird). The bullet will then move from the cannon to the target. Here is an illustration:


For illustration, the same bullet is shown multiple times on the screenshot above. However, in the real game, only one bullet will be shown as it moves to the destination.

As the bullet hits the target successfully, the target explodes and gets killed. An explosion sound can also be heard. Note that the score at the bottom-right corner of the screen is then increased by 1. The player\'s objective is to kill as many targets as possible in the given time which is 60 seconds by default. The remaining time can also be seen at the bottom-right corner of the screen.

End of the game

The game is over when the time is up. The \"end game\" sound will be played and the \"end game\" screen will be shown:


On the terminal, the player will be asked for his/her name:


After the player enters his/her name, a highscore table showing the best score records, sorted by the scores, will be shown:



To help you understand the flow of the game better, here are some flowcharts of the game. The main flow of the whole game is as follows:


Notice that our game is event-driven. It handles the mouse-moved, mouse-clicked, and timer-triggered events.

We move the cannon and the initial bullet above it when we have a mouse-move event:


And if the player clicks on the screen, we fire the bullet:


There is also a timer that triggers every 1 second. It updates the remaining time and checks if the game is over:



Similar to some of the labs, a starting project has been provided to you. Its implementation is incomplete. You will need to complete all the methods in the StudentController class and the StudentModel class.

For details on what you need to do, refer to the documentation comments above each of those methods and look at this documentation of some assignment classes that you might need to use in your code.

You may also refer to this demo program of a finished work.


Here is the distribution of the assignment marks. The total is 100%. The optional bonus part can add at most 10% on top of it.

   Implementation: 90%

?                   Correct implementations of the methods in the StudentController class and the StudentModel class.

   Code style: 10%

?                   It includes proper indentations, meaningful variable naming, good code structure and readability.

   Bonus (optional): 10%

?                   You can add some new feature(s) to the game to get at most 10% of bonus marks for the assignment. We will award the bonus marks to you based on the creativity and the implementation difficulty of the new feature(s) at our discretion.


The submission deadline is 11:59:00pm, Wednesday, 7 May 2014. You must zip your whole assignment project and submit the zip file only. You may make multiple submissions and only the latest submission will be graded.

You will be using the CASS to submit your work. You may refer to the submission instructions here. You should submit your work early to avoid any kind of submission problem in the last minute. No late submission and no email submission will be accepted.

About plagiarism

If you get caught cheating, both you and the other person get zero for the assignment. It doesn\'t matter if you only copied a little. UST rules say that the penalty is the same for both people. There may also be additional penalties other than just getting zero for the assignment. You are responsible for keeping your own work safe from being accessed or \"referenced\" by others in any way. However, discussing with others is fine as that\'s different from direct copying. Also be reminded that the plagiarism detection software are very robust nowadays, and on top of that we will also examine your works manually.


1.          Q: My code doesn\'t work / there is an error, here is the code, can you help me fix it??A: As the assignment is a major course assessment, to be fair, you are supposed to work on it on your own and we should not finish the tasks for you. We might provide some very general hints to you, but we shall not fix the problem for you.

2.          Q: For the updateTargetPositions method, can I always move the target to a specific direction only (e.g. always move left whenever moving left is possible)??A: There should always be non-zero chances for the target to move to any of the eight possible positions whenever those positions are available (i.e. empty and not out-of-boundary). For example, if a target can move up, right, or down-left. Then the target should have non-zero chances to move in any of these 3 directions. The probabilities do not have to be the same, but each of them must be non-zero.

3.          Q: How does the game check if the bullet hits a target? It seems different from the lab.?A: The hit checking mechanism in lab 9 is different from that in the assignment as we are now shooting in a 3D space instead of a 2D space. In lab 9 a target is considered to be hit when the bullet and the target collide. However in the assignment, a target is considered to be hit if the bullet image is within the area of the target image when it has traveled to its final position. You will not need to implement it though as we have handled it in the assignment library.

4.          Q: A strange runtime error happens at the end when the highscore table is read/shown/written. I am sure my updateHighScoreRecords method is totally correct. Any hint??A: An error may happen when the game tries to read from an incorrectly-formatted highScore.txt file that you created earlier. You are advised to erase the content of the highScore.txt completely (not even a space or newline should exist) and try again. If the problem persists, then your code is probably incorrect.

5.          Q: It seems that some behaviors of the two starting code are different, which one should I follow??A: The new version of the starting code, which includes the game core source code, has some minor changes and improvements. For those behaviors that are different in the two versions, following either one is perfectly fine. Actually, we will not test anything that is not written or implied in the documented requirements. Also, you will probably find something in the game that you can improve, you are more than welcome to improve the game and get some bonus points.

6.          Q: What is the BufferedReader that is used in the outputHighScoreTable method??A: This is the official documentation for this class. As a hint, for the outputHighScoreTable method, the BufferedReader will be used to read a line from the file and then a Scanner can be used to scan the read line for the \"name\", \"level\", and \"score\".

7.          Q: What should I return in the generateIntermediateBulletImage method? Can I just return depthImages[0]??A: A correct depth image (from the depthImages array) must be returned. As described in the documentation comment, linear interpolation should be used. At the initialStep, the first depthImage (i.e. depthImages[0] should be used and returned.) and at the finalStep, the last depthImage (i.e depthImages[depthImages.length - 1]) should be used and returned. You should not always use depthImages[0]. You can see the different depth images used in the \"bullets\" directory under the \"images\" directory of your project.


Q: In the assignment, readability is one of the criteria in Code Style(10%) in grading. My question is that whether the readbility includes documentation and we need to write documentation for the code written by us in order to enhance the readbility??A: For that, you don\'t have to write the method documentation, which is on top of each method, because it is already provided to you in the starting code. However, it is a good idea to write some comments beside your code to explain the logical flow and what is being done here and there. You may refer to the lab 10 solution for some examples. You don\'t have to add comments to every single code statement, but some comments should be added to explain the not-so-obvious parts.

Solution Description