Advertisement
gandalfbialy

Untitled

May 10th, 2025
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class PaddleScript : MonoBehaviour
  4. {
  5. public float speed = 5f;
  6.  
  7. // Update is called once per frame
  8. void Update()
  9. {
  10. Move();
  11. }
  12.  
  13. void Move()
  14. {
  15. float xMovement = Input.GetAxis("Horizontal");
  16.  
  17. float xSpeed = xMovement * speed * Time.deltaTime;
  18.  
  19. transform.position += new Vector3(xSpeed, 0, 0);
  20. }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement