Friday, January 29, 2016

Retro Revolution: Building a Pong Clone in Unity

Before starting you can view the game at itch.io

Analyzing Pong

Pong was one of the first video games ever made and was the first successful commercial game. When Pong was first created the developers most likely struggled with the logic for the code, however, nowadays you can make a simple two player Pong with one method call, colliders, and sprites. Pong gets harder to create once the decision to make a one-player Pong is made. In this tutorial, we will create the base gameplay for Pong and break down a very simple AI alternative that still adds to gameplay value.

We must ask, what are the core elements of Pong gameplay? Here is a list with the answer to that question:

  1. Player Input - We want the player to be able to move their paddle up and down so that they can hit the ball.
  2. Ball Collision - When the ball hits the paddle or boundaries it can’t be allowed to lose any speed.
  3. Boundary Collision - The ball has to be able to bounce off of the top and bottom part of the screen so that it doesn’t leave the play area.
  4. Enemy AI - The gameplay value of the game would be next to zero if the enemy sat on the opposite end of the screen and didn’t move.
  5. Spawning the Ball - When the ball hits one of the boundaries behind the paddles we need it to respawn so that we can continue the game.
  6. Ball to Paddle Hit Area Detection - This allows for the ball to bounce off the paddle at unique angles so that we are able to to better aim the ball when it is hit with the paddle.

With this list we can beginning programming the game.

Note that any numbers used relating to a game object’s location, rotation, scale, etc are relative and may need to be changed for your specific setup.

Continue reading %Retro Revolution: Building a Pong Clone in Unity%


by Vincent Quarles via SitePoint

No comments:

Post a Comment