Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Movement : MonoBehaviour
  6. {
  7.  
  8.  
  9. public float speed;
  10. private Vector2 movVel;
  11.  
  12. private Rigidbody2D rb;
  13. public float upSpeed;
  14.  
  15. private void Start()
  16. {
  17. rb = GetComponent<Rigidbody2D>();
  18. }
  19.  
  20. void Update()
  21. {
  22. Vector2 mov = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
  23. movVel = mov * speed * Time.deltaTime;
  24. rb.velocity = Vector2.up * upSpeed * Time.deltaTime;
  25.  
  26. }
  27.  
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement