Scratch Football Game Tutorial

Have a play of today’s game with  a friend to see how it works!

Sprites

Scratch Football Game Tutorial

Here are the sprites that you will need to have by the end of the game!

You will need:

  • Player 1 – Scratch
  • Player 2 – Avery
  • Ball – Ball
  • Goal 1 + 2 –  paint your own
  • Goal 1 + 2 hidden sprite (for scoring) – paint your own.

Player Code 1

p1-code

Player 2 Code

p2-code

Here is the code for each of the players. The job of this code is to:

  • Move the players to their starting positions at the start of the game
  • Move the players
  • Control the dribbling and kicking actions

Ball Code

ball-code

Here is the ball’s code. The ball code performs a number of functions:

  • Moves and bounces the ball in different directions
  • Applies acceleration and deceleration
  • Moves to the center after a goal

Hidden Goal Code

Player 1 Hidden Goal Code

hidden-goal-code

Player 2 Hidden Goal Code

hidden-goal-code-2

This is the code for the hidden goal sprite, it just has one  function:

  • Check if the ball is touching it, if so change the score  and move the ball to the centre

Easy Challenges

  • Add sound effects to the ball and players
  • Add background music

Medium Challenges

  • Add a game-over screen for when a player reaches a certain number of goals / or a countdown timer has been reached.
  • Add on pitch power-ups, eg:
    • Make opponent’s nets bigger.
    • Super fast kick ability
    • Slow opponent down ability

Insanely hard Challenges

  • Create an AI player to play instead of player 2
  • Create a score table to record team scores