using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player2D : MonoBehaviour { public float speed = 5.0f; Rigidbody2D rb; Vector2 movement; void Start() { rb = GetComponent(); } void Update() { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); } void FixedUpdate() { rb.MovePosition(rb.position + movement * speed * 0.02f); } }