14 November 2014

Pong tutorial - part 1

So far I went through step one and two of the Pong tutorial that can be found here:

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

So these are the things I've learned so far:
  • Setting up the background and camera 
  • Adjusting object positions
  • Creating new layers and locking them
  • Adding physical components to objects (box collider2D to put a hit box around the object and rigidbody2d to add interactivity)
  • Adding scripts to objects
  • Paddle code which covers: 
    • moving the paddles up and down using keyboard inputs
    • making them move at a certain speed
    • making the paddles stop when no keyboard input is active
This is my stage so far:


And this is the paddle code I followed:

The second paddle has identical code with the exception that it gets triggered by the W and S buttons.

Tomorrow I'll add the ball and the code for it so that it moves freely and bounces off objects. I'll also set boundaries within the world so that the ball stays on stage.

No comments:

Post a Comment