TASK #1
TASK:
Create an html file called cookie_create_start and add an account creation form.
HINT:
Use the var
keyword to create a global
variable at the top of your program. Then use the equals operator to set the variable to the value 15.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #2
TASK:
Add a link to ‘cookie_create_start’ from cookie_login_start.
HINT:
Add an addEventListener to the start function that will
run a function called select_cursor. When select_cursor is executed, decrease num_cookies by cursor_cost
and increase cursor_cost by multiplying by 1.2.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #3
TASK:
Create a PHP file called ‘cookie_create_account’.
HINT:
Create a function called hideShow
that is
run in update
. In hideShow, use getElementByID to change the opacity
of the div containing
the picture of the cursor to 1 if “num_cookies” is greater than or equal
to “cursor_cost.
Otherwise, the div’s opacity
should be set to 0.2.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #4
TASK:
Read in the POST data, connect to DB, and select the table.
HINT:
Create a variable called num_cursor
that will
contain the number of cursors the user has bought. Be sure to initialize the variable to 0
. You
will need to increment this variable every time the user buys a cursor. Then, you will need to
use getElementByID to update the text to show the content of “num_cursor”. Remember that you will
need to use Math.floor()
to ensure that decimal places are not shown to the user.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #5
TASK:
Check if both the passwords are equal.
HINT:
Create a global variable called CPS
that
will contain the number of cookies per second. Be sure to initialize it to 0. You will
need to increment the CPS variable by 0.1 every time a cursor is purchased. Remember that
you will need to show the content of CPS by using getElementByID.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #6
TASK:
If the passwords are not equal, set a SESSION variable and go to cookie_create.
HINT:
You will need to increment num_cookies by
CPS/10
in the update function. You need to divide by 10 since update is running every 100
milliseconds, which is 10 times per second.
CHECK UP:
Watch the video below to check that you completed the task.
TASK #7
TASK:
Adjust cookie_create to read the “no_match” SESSION variable.
HINT:
You have several options: download a sound from a
sound archive website, rip a sound effect off of youtube, download a library of sounds, or use the
sounds I used here. Once a
sound file is downloaded, you will need to create a folder called sounds
and place the files there.
Refer to the video below to see how to complete each task.
CHECK UP:
Watch the video below to check that you completed the task.