Skip to content
Permalink
42408e4631
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
18 lines (12 sloc) 433 Bytes
using UnityEngine;
using System.Collections;
public class Paddle : MonoBehaviour {
public float paddleSpeed = 1.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), -4.0f, 0f);
transform.position = playerPos;
}
}