Advertisement
crystalguy123

Untitled

Jan 30th, 2020
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlayerMovement : MonoBehaviour
  6. {
  7. // Start is called before the first frame update
  8.  
  9. public float speed;
  10. public float jump;
  11. private float move;
  12. private Rigidbody2D rb;
  13.  
  14.  
  15.  
  16. void Start()
  17. {
  18. rb = GetComponent<Rigidbody2D>();
  19. }
  20.  
  21. // Update is called once per frame
  22. void Update()
  23. {
  24. move = Input.getAxisRaw("Horizontal");
  25. rb.velocity = new Vector2(move * speed, rb.velocity.y);
  26.  
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement