CODE CREATIVE
SOCCER
Or is it futbol?
TASK #1
The "Soccer" program will ask the user to create a game of soccer that will allow players to kick a ball around a field and into each other's goal. This project is quite advanced and only the most skillful will be able to complete it.

The first task is to watch the introduction video below
to get an idea of what the project entails. An extension exercise here is to also create 2 extra players that will act as goalies.
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:
In this task, you will make Player 1 move left and right based on the 'a' and 'd' keys.

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

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Get Player 1 to move up and down using the 'w' and 's' keys.
TASK #3
TASK:
Make the Intro screen appear when the Green Flag is clicked and play the Goal sound. After a second, cause the backdrop to switch to the Field.

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

CHECK UP:
Watch the video below to check that you completed the task.
TASK #4
TASK:
Resize the players and ball to appropriate sizes and place them where they should start out at.

HINT #1:
You will need to use the
"Set Size"
,
"Go To"
,
"Not"
,
"Show"
, and
"When Backdrop Switches To"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #5
TASK:
Allow Player 1 to move only 2 seconds after the screen switches to the Field.

HINT #1:
You will need to create a variable and use the
"Set Variable To"
,
"Wait"
,
"If"
, and
"Equals"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #6
TASK:
Cause the P1 Bottom and P1 Bottom Right sprites to be located at their correct locations when the Green Flag is clicked.

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

CHECK UP:
Watch the video below to check that you completed the task.
TASK #7
TASK:
Make the sensor sprites follow Player 1 around the screen.

HINT #1:
You will need to use the same blocks as you used when completing Task #2

CHECK UP:
Watch the video below to check that you completed the task.
TASK #8
TASK:
Don't allow Player 1 to move off of the left side of the screen.

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

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Limit Player 1's movement when moving North, East, and South.

TASK #9
TASK:
Create a set of variables that will store Player 1's ever-changing x and y positions.

HINT #1:
You will need to create a variable and use the
"Change Variable By"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #10
TASK:
Set the position of the P1_bottom_right sprite when Player 1 hits any of the edges of the screen.

HINT #1:
You will need to use the
"If"
,
"Greater Than/Less Than"
, and
"Set X/Y"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Set the position of the other sensor sprites when Player 1 hits any of the edges of the screen.

TASK #11
TASK:
Check that your sensor sprites are behaving correcting when Player 1 hits the 4 edges of the screen. Also, make Player 1 animate through his costumes when the game starts.

HINT #1:
You will need to use the
"Forever"
,
"If"
,
"Next Costume"
, and
"Equals"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #12
TASK:
Make the ball glide downward when touching P1_bottom and glide downward and to the left when touching P1_bottom_left.

HINT #1:
You will need to use the
"Forever"
,
"If"
,
"Touching Sprite"
, and
"Glide"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #13
TASK:
Set a boundary for the ball when it gets kicked towards the top of the screen.

HINT #1:
You will need to use the
"When Backdrop Switches"
,
"Forever"
,
"If"
,
"Greater Than"
, and
"Set Y"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Set the boundaries for the ball when it goes towards the other 3 edges of the screen.

TASK #14
TASK:
Cause the ball to not bounce back when it is at the right goal.

HINT #1:
You will need to use the
"And/Or Operator"
,
"Less/Greater Than"
, and
"Y Position"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #15
TASK:
Create two variables that will contain the scores of the players and cause the variables to go up when the ball touches the goal.

HINT #1:
You will need to use the
"When Backdrop Switches"
,
"Forever"
,
"If"
,
"Touching"
, and
"Change Variable"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #16
TASK:
Only change the score by 1 when the ball crosses the goal. Also, reposition the player to the starting location. Also, reposition P1_bottom_right to the starting location when a goal is scored.

HINT #1:
You will need to use the
"Wait"
,
"When I Receive Broadcast"
,
"Go To X/Y"
,
"Change Y"
, and
"Change X"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Reposition the other sensing sprites when a goal is scored.

TASK #17
TASK:
Play the Goal sound and have Player 1 race around the screen in celebration when they score a goal.

HINT #1:
You will need to use the
"When I Receive"
,
"Glide"
, and
"Play Sound"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #18
TASK:
Make the Goal sprite show when a goal is scored.

HINT #1:
You will need to use the
"When I Receive"
,
"Show"
,
"Wait"
, and
"Hide"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #19
TASK:
Program a win condition that is based on the timer. Once the timer gets past a certain number of seconds, determine a winner and display the correct backdrop.

HINT #1:
You will need to use the
"If"
,
"Greater Than"
,
"Broadcast"
,
"Hide Variable"
, and
"Hide"
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Add a condition that checks if there was a tie.
  2. Complete the same game algorithms for Player 2.


Congratulations, you have created Soccer!
ADDITIONAL CHALLENGE EXERCISES
  1. Program a superkick button that will kick the ball further than a normal kick.
  2. Only allow a player to superkick after waiting 10 seconds to recharge.
  3. Program a offsides kick when the ball goes out of bounds.
  4. Program an overtime when there is a tie.
  5. Program a shootout if there is a tie at the end of overtime.
  6. Program a coin toss at the start of the game to decide which goal to use.
  7. Allow the players to choose the sprites they will play with.
  8. Program a 4 player game that has 2 players on each side.