Skip to content
Permalink
2f0f037344
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (13 sloc) 473 Bytes
using UnityEngine;
using System.Collections;
public class Paddle : MonoBehaviour {
public float paddleSpeed = 1.0f;
public float paddlePosY = -4.0f;
private Vector3 playerPos = new Vector3 (0, -4.0f, 0);
// Update is called once per frame
void Update () {
float xPos = transform.position.x + (Input.GetAxis ("Horizontal") * paddleSpeed);
playerPos = new Vector3 (Mathf.Clamp (xPos, -5.0f, 5.0f), paddlePosY, 0f);
transform.position = playerPos;
}
}