CODE CREATIVE
GOTCHA!
There can be only one...
TASK #1
The "Gotcha!" program is a clone of
Diep.IO
, which is a game where two players fight to become ruler of the the IO world. The turtorial below shows how to create the basic game, and offers a set of challenge exercises to make things even more interesting.

The first task is to watch the introduction video below
to get an idea of what the project entails.
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:
Have the game start at the
intro
screen and play the "Gotcha!" sound. Be sure to include a graphic effect before switching the background to the map.

HINT #1:
Use the
"Switch backdrop"
,
Start sound
,
repeat
and
Change effect
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
TASK #3
TASK:
Add the player 1 sprite in the correct location when the game starts. Be sure to have them appear in the top left and bottom right corners, respectively.

HINT #1:
Use the
goto x/y
block.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #1
  1. Place the player 2 sprite in the correct starting location when the game starts.
TASK #4
TASK:
Add code that will allows player 1 to move around the screen using 'wasd' keys.

HINT #1:
You will need to use the
"When key pressed"
,
Repeat until
, and
Change y by
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #2
  1. Add code that allows player 2 to move around the screen using the '5123' keys.
TASK #5
TASK:
Add borders to player 1's movements so that they cannot fly off the screen.

HINT #1:
You will need to use the
If statement
,
Touching edge
, and
Change y by
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #3
  1. Add code that restricts player 2's movements so that their sprite is always in the screen.
TASK #6
TASK:
Restrict the movement of player 1 so that they cannot move through the gray walls of the map.

HINT #1:
All you will need for this task is the
OR operator
block.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #4
  1. Restrict player 2's movements so that they cannot move through the gray walls of the map.
TASK #7
TASK:
Add code so that player 1 cannot move during the intro portion of the game.

HINT #1:
You will need the following blocks for this task:
Create a variable
,
Set a variable
,
If statement
, and the
EQUALS operator
.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #5
  1. Add code that restricts player 2's movements while the intro screen is showing.
TASK #8
TASK:
Allow player 1 to shoot bullets by pressing the 'SPACE' bar.

HINT #1:
You will need the following blocks for this task:
When key pressed
,
Repeat until
, and the
Change x by
.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #6
  1. Allow player 2 to shoot bullets using the '0' button.
TASK #9
TASK:
Stop player 1 from being able to shoot bullets by holding down the
SPACE
bar. Allow only one bullet to fire each time the button is pressed.

HINT #1:
You will need the following blocks for this task:
If statement
and the
set variable
.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #7
  1. Allow only one bullet to be fired each time the '0' button is pressed for player 2.
TASK #10
TASK:
Make the player 1's cannon rotate 360 degrees. The 'v' button should cause the cannon to rotate counterclockwise and the 'b' button will cause the cannon to rotate clockwise.

HINT #1:
You will need the following blocks for this task:
When key pressed
,
Repeat until
, and the
Turn degrees
.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #8
  1. Program the left arrow and right arrow to rotate player 2's cannon counterclockwise and clockwise, respectively.
TASK #11
TASK:
Cause player 1's bullets to fire at the angle that the cannon is facing.

HINT #1:
You will need the following blocks for this task:
Create variable
,
Set variable
,
Change variable by
,
Point in direction
, and the
Move steps
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #9
  1. Cause player 2 to fire bullets at the angle their cannon is facing.
TASK #12
TASK:
Make player 1's bullets stop when they hit the gray wall.

HINT #1:
You will need the following blocks for this task:
If statement
,
Touching color
, and the
Delete clone
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #10
  1. Make player 2's bullets stop when they hit the gray wall.
TASK #13
TASK:
Add an energy variable to player 1 and a hit condition that causes the energy to decrease when player 1 is struck by a bullet.

HINT #1:
You will need the following blocks for this task:
If statement
,
Touching sprite
,
Change variable
, and the
Delete clone
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #11
  1. Give player 2 an energy variable and cause it to decrease when they are hit by a bullet fired by player 1.
TASK #14
TASK:
End the game when player 1's energy variable becomes a value that is 0 or less.

HINT #1:
You will need the following blocks for this task:
If statement
,
Less than operator
, and the
Switch backdrop
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGE EXERCISE #12
  1. Make the game end when player 2's energy variable goes down to 0 or less.
TASK #15
TASK:
Stop the background music from playing when the game ends. Also, remove the left over sprites from the screen when the ending screen is shown.

HINT #1:
You will need the following blocks for this task:
Broadcast
,
If statement
,
Stop all sounds
,
Start sound
, and the
Stop this script
blocks.

CHECK UP:
Watch the video below to check that you completed the task.
CHALLENGES EXERCISES
  1. Add an intro animation involving the players.

  2. Add an animation when the cannon is fired.

  3. Add an animation when a player's energy reaches 0.

  4. Limit the number of bullets and add a clip powerup that refills bullets.

  5. Make the game's winner determined by the best 2 out of 3.

  6. Add sound effects.

  7. Allow the players to choose different maps.

  8. Add powerups: shoot two bullets, homing bullet, explosion bullet, freeze other player, slow other player, other player can't shoot, shoot through walls, take 1 energy off other player, ect.

  9. Add a 3rd or 4th player.

  10. Create a 2 vs 2 game.