Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Paddle : MonoBehaviour {
  5.  
  6.     // Use this for initialization
  7.     void Start () {
  8.    
  9.     }
  10.    
  11.     // Update is called once per frame
  12.     void Update () {
  13.     Vector3 paddlePos = new Vector3 (0.5f, this.transform.position.y , 0f);
  14.     float mousePosInBlocks = Input.mousePosition.x / Screen.width*16;
  15.     paddlePos.x = Mathf.Clamp (mousePosInBlocks, 0.5f, 22f);
  16.     this.transform.position = paddlePos;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement