CODE CREATIVE
ACCOUNT CREATION
Inserting credentials
TASK #1
TASK:
If the passwords are equal, prepare and run the SELECT query.

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:
Prepare the INSERT query.

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:
Run the INSERT query and save the client's ID number in a session variable.

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:
Save the id and username to SESSION variables and go to cookie_clicker.

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 #5
TASK:
Adjust cookie_clicker to check if the SESSION id variable is set.

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.
TASK #6
TASK:
Print out the username of the client on top of the picture of the cookie.

HINT:
You will need to create a global variable called
snd_cursor
and set it equal to the appropriate sound file using the Audio class along with a pathway to the file. To play the file, use the Audio class’
play
method at the appropriate time.

CHECK UP:
Watch the video below to check that you completed the task.