15 November 2014

Pong tutorial - part 2

Today I have completed step three and step four of the following Pong tutorial:

http://www.awesomeincu.com/tutorials/unity-pong/

This is what I've learned from them:
  • Applying a circle collider to the ball
  • Creating and applying a physics2D material to the ball + adjusting friction and bounciness
  • Ball code which covers:
    • moving the ball at certain x and y speeds
    • making the ball move after 2 sec when the game's started
    • random direction at which the ball is starting
    • resetting the ball when a player wins or presses the reset button
    • adjusting the velocity of the ball depending on the collision against the paddle
  • Adding walls around the stage to not let the ball move off the screen, and having them placed inside the HUD object variables to be able to control them all at once for the future
Scene view:

Game view:

Ball code:

HUD variables for the walls:

And the wall objects placed inside them:

Next time I'll undertake step 5 where I'll be adding the score interface.

No comments:

Post a Comment