Advertisement
Guest User

code

a guest
Feb 26th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. using UnityEngine;
  3.  
  4. public class Playermovement : MonoBehaviour
  5. {
  6. public Rigidbody2D rb;
  7. public float mspeed = 7;
  8. public static System.Numerics.Vector2 Normalize;
  9. Vector2 movement;
  10.  
  11.  
  12. void Update()
  13. {
  14. var movement.y = Input.GetAxisRaw("Vertical");
  15. var movement.x = Input.GetAxisRaw("Horizontal");
  16. }
  17. void FixedUpdate()
  18. {
  19. rb.MovePosition(rb.position + movement + mspeed * Time.fixedDeltaTime);
  20.  
  21. }
  22. }
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement