Skip to main content

Game Data

Now that we have a basic structure for our game laid out, we need to think about what kind of data exists in Pong.

The Building Blocks#

To do so, let's list out the objects in the game:

  • The ball
  • The player's paddle
  • The AI paddle

Now, let's dive a little deeper and think about the attributes each of these items has.

The Ball#

  • An (x, y) position
  • An x velocity
  • A y velocity

The Player's Paddle#

  • An (x, y) position
  • A size
  • A score

The AI Paddle#

  • An (x, y) position
  • A size
  • A score
note

The AI Paddle may have more data associated with it depending on how sophisticated the AI controlling the paddle is.

Data to Code#

drawing

This Content is Locked

Enter your GCA kit's access code to continue