SHARE
TWEET

PaddleCodePart1

a guest Jul 24th, 2015 7,385 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Paddle : MonoBehaviour
  5. {
  6.     public float paddleSpeed = 1;
  7.     public Vector3 playerPos;
  8.  
  9.     void Update()
  10.     {
  11.         float yPos = transform.position.y + (Input.GetAxis("Vertical") * paddleSpeed);
  12.         playerPos = new Vector3(-20, Mathf.Clamp(yPos, -11, 11), 0);
  13.         transform.position = playerPos;
  14.     }
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top