Perform the following steps:
1. Create a Web page called “game.html” and place it in the root directory. To that page, add a layer, which will be treated as an object, with an image for its contents. Add another image which will start the game when clicked on. When the game starts, the layer, including the image, will move randomly in any direction but not more than 10 pixels. The layer will not leave the visible screen space. You may assume an 800x600 resolution setting. Be creative when choosing your images, but avoid anything that may be considered explicit or offensive.
2. Add a timer, or loop, to determine how long the game will run. This should be set to 30 seconds. You will need to experiment to determine how many times a loop must repeat to make it last 30 seconds. One of the ways to accomplish this is by using the command “setTimeout()” which executes a code some time in the future. As an example, the following command will call the function “FlyLogoIE” exactly 50 milliseconds after this line is executed:
3. The game should proceed as follows:
a. The score starts at 0. Each time the user clicks the image, one point is added to the score. This score is constantly displayed either on the status bar or somewhere in the background.
b. On every click, the layer also moves randomly, by not more than 10 pixels, to another part of the screen.
c. The game continues until the time runs out. Optionally, a dialog box appears telling the user his or her final score. The user now has the option to restart the game by clicking the “Start” image again.
4. For an extra challenge, implement levels of difficulty for the game. Add instructions that prompt the user for the level of difficulty at which he or she wants to play. A higher level of difficulty would correspond to either faster motion, a smaller target, or both. Perform this step only if all other requirements are met and you still have time before the due date. No extra points will be given to you for this step.
5. Add a link from your homepage to this web page.
6. Test the code thoroughly before publishing it.
7. Publish your work by uploading the new and modified files to your web host.
8. You can use the checklist to test the code thoroughly after it has been uploaded. It is highly unlikely that your game will work perfectly the first time. This step illustrates the need for code validation, especially on dynamic content.
Use this rubric to estimate your grade on the assignment. Submit a copy of the completed form with your assignment.
Zip your files, including the Word document, into a single file and submit it.
- This solution has not purchased yet.
- Submitted On 07 Apr, 2015 10:17:12