CODE CREATIVE
SPEAR FISHING
Watch out for sharks!
TASK #1
The "Spear Fishing" program will ask the user to create a game where a scuba diver will need to collect as many fish as he can while avoiding sharks and making sure to refill his load of spears.

The first task is to watch the introduction video below
to get an idea of what the project entails. An extension exercise includes adding a shark that is controlled by a second player.
After watching the video, be sure to
open up the "Starter Pack"
. Make sure you click on the remix button after Scratch opens up so that it saves on your account.
TASK #2
TASK:
To start the game, show the
Intro Screen
that plays the
Bubbles
sound effect. After showing for 2 seconds, switch the backdrop to the
Game Screen
.

HINT #1:
You will need to use the
"Green Flag"
,
"Switch Backdrop"
, and
"Play Sound"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #3
TASK:
Make the boat, spear and scuba diver sprites appear when the backdrop switches to the Game Screen. Also, play the Baby Shark music file on repeat.

HINT #1:
You will need to use the
"When Backdrop Switches"
,
"Show"
,
"Forever"
, and
"Repeat Sound Until Done"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #4
TASK:
Cause the Yellow Fish to appear at random locations on the screen at random times when the game starts.

HINT #1:
You will need to use the
"When Backdrop Switches To"
,
"Forever"
,
"Wait"
,
"Pick Random"
,
"Create Clone"
and
"Go To X & Y"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #5
TASK:
Cause the Yellow Fish to appear randomly on the left or right side of the screen.

HINT #1:
You will need to use the
"If/Else"
and
"Pick Random"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #6
TASK:
Make the Yellow Fish appear below the water and above the sand. Also, have the fish look in the correct direction when they are cloned.

HINT #1:
You will need to use the
"Switch Costume"
, block.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #7
TASK:
Have the fish swim from one side of the screen to the other.

HINT #1:
You will need to use the
"Glide"
,
"Hide"
, and
"Y-Position"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #8
TASK:
Make the fish swim at a slower rate that is random. Also, make the fish a random size.

HINT #1:
You will need to use the
"Set Size"
, and
"Pick Random"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Make the Blue Fish and Pink Fish appear randomly.
  2. Remember that the Pink Fish is rarer than the Blue Fish and the Blue Fish is rarer than the Yellow Fish.
TASK #9
TASK:
Make the Scuba Diver controllable using 'wasd'. Also, make the Scuba Diver is looking in the same direction as he is swimming.

HINT #1:
You will need to use the
"When Key Pressed"
,
"Repeat Until"
, and
"Not"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #10
TASK:
Cause the Spear to follow the Scuba Diver as he swims around the sea.

HINT #1:
You will need to use the
"Forever"
,
"Go To"
,
"Change X By"
, and
"Change Y By"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #11
TASK:
Create a direction variable that will store a 0 if the diver is facing towards the left and will store a 1 if the diver is facing towards the right.

HINT #1:
You will need to use the
"Set Variable"
, block and create a variable.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #12
TASK:
Use the direction variable to cause the spears to hide or show based on which direction the diver is facing.

HINT #1:
You will need to use the
"If/Else"
, and the
"Equals Operator"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #13
TASK:
Use the direction variable to cause the Left Spear to fly towards the left side of the screen.

HINT #1:
You will need to use the
"When Key Pressed"
,
"If"
, and
"When I Start As Clone"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Cause the right spear to shoot out when the space bar is pressed.
TASK #14
TASK:
Don't allow the Scuba Diver to fly out of the water or into the sand.

HINT #1:
You will need to use the
"Green Flag"
,
"Switch Backdrop"
,
"Green Flag"
,
"Green Flag"
,
"Green Flag"
and
"Say"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Don't allow the Scuba Diver to swim past the left or right side of the screen.
TASK #15
TASK:
Cause the Yellow Fish and the Spear to be removed when they hit each other. Also, increment the Fish Caught variable by one when this happens.

HINT #1:
You will need to use the
"If"
,
"Touching"
, and
"Delete Clone"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Cause the other fish to be removed if touching a spear.
  2. Remember that Blue Fish are worth 2 and Pink Fish are worth 3.
TASK #16
TASK:
Make the shark appear randomly from the left and right side of the screen.

HINT #1:
You will need to use the same blocks that you used in Task #8.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #17
TASK:
Make the shark glide up or down towards the diver.

HINT #1:
You will need to create a variable that will store the diver's y position and use that value to determine where the shark is gliding.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #18
TASK:
Set the Fish Caught variable to 0 if the shark touches the diver.

HINT #1:
You will need to use the
"When I Start As Clone"
,
"Forever"
,
"If Touching"
,
"Set Variable"
, and
"Play Sound"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #19
TASK:
Limit the number of spears the diver can throw to 6.

HINT #1:
You will need to create a variable that will contain the number of spears thrown and
"Change Variable By"
, and
"Less Than Operator"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #20
TASK:
Replenish the diver's spears when he touches the top of the boat.

HINT #1:
You will need to use the
"If"
,
"Touching Color"
, and
"Set Variable"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #21
TASK:
Watch the video below to clean up some loose ends.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #22
TASK:
Program an end to the game using the timerTask.

HINT #1:
You will need to use the
"If"
,
"Greater Than"
,
"Broadcast"
, and
"When I Receive Broadcast"
, blocks.

CHECK UP:
Watch the video below to check that you completed the task.
Congratulations, you have created Spear Fishing!
ADDITIONAL CHALLENGE EXERCISES
  1. Make the shark disappear if hit with 4 spears.
  2. Show pictures of the number of spears the diver has available.
  3. Cause the fish to be saved only if the diver touches the boat.
  4. Have the boat sway from left to right throughout the game.
  5. Make the Blue Fish take two hits to remove.
  6. Make the Pink Fish take 3 hits to remove.
  7. Program the game to restart after it finishes.
  8. Display the high score.