Skip to main content

Posts

Showing posts from March, 2015
Pong Lately I have been overwhelmed with my current project so I thought it would be a good time to take a step back and do something simple. For anyone who doesn’t know, pong is basically a simulated table-tennis game. It was one of the first video games, so I thought it would be a good place to start this blog. I decided to use Unity to make the game. The coding for it was all pretty simple. The ball has a variable for its speed in the x and y direction. Every frame it calls a function that increments its current position by these variables.         There are six surfaces the ball can hit. These are the top wall, bottom wall, right wall, left wall, and one of the two paddles. If it hits the left or right wall that is a score and the game resets. If it hits the top wall, bottom wall, or one of the paddles it bounces off and goes in the opposite direction. I did this by reversing the perpendicular speed variable. For example, if it hits the top ...