Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PongPaddle : MonoBehaviour
- {
- [SerializeField] private float speed = 5f;
- [Range(1, 2)]
- [SerializeField] private int playerNumber = 1;
- private void Update()
- {
- Move();
- }
- private void Move()
- {
- float y = Input.GetAxisRaw("Vertical" + playerNumber);
- float speedDir = y * speed * Time.deltaTime;
- transform.position += new Vector3(0, speedDir, 0);
- }
- }
Advertisement
Advertisement