Advertisement
Guest User

PaddleCodePart1

a guest
Jul 24th, 2015
7,859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement