You may work individually or in groups of 2 people to finish this project. We expect that the programming will be your group's effort and not the effort of other persons. If you have questions or need assistance with your program, the instructor and the TAs are very willing to help and are available during their office hours.
Check out the page on programming tips to help you. Also, look at the page on PP 1 grading criteria (and Lab 3 grading criteria) to see the breakdown of the points given for this project.
When you complete your project, create a link to it from your course web page, and copy it to the web server. Make sure that the project works correctly after you have published it.
Good programs include good indentation, good variable names, and comments that help the author (or someone else) understand who developed the program and what is going on. (See the grading criteria to see how comments and program style are evaluated.)
For this project you will be changing the picture of the pet depending on its state. You will also add some communication to the owner and visually enhance the page.
imgtag that displays your pet. Then you will need to change the display function to add the following command inside each
ifaction either before or after changing the value of the text field.
document.getElementById('petpic').src = "newpic.gif";
imgtag and newpic.gif is the name of the picture file. Each state must have a different picture so make sure that each state is identified in this function.
false. The text on the button should initially say "Pause". If the button is clicked when the simulation is not already paused, then the value of the variable should be changed to
trueand the text on the button should be changed to "Resume". If the button is clicked while the pet is paused, then the variable should be changed to
falseand the text on the button should be changed back to "Pause". You will also have to add a check inside the
updatefunction that only allows the code in the function to be executed if the pet is not paused. You will also need to disable each of your buttons to prevent users from interacting with your pet when the pet is paused, and then turn them back on when your pet resumes. Buttons have a
disabledproperty that can be set to
false, as in
myBtn.disabled = true, or
myBtn.disabled = false
myBtnis the id of a button.
typeattribute of those text fields to "hidden".