📅  最后修改于: 2022-03-11 14:49:05.439000             🧑  作者: Mango
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f;
public Rigidbody2D rb;
Vector2 movement;
// Update is called once per frame
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}
void FixedUpdate()
{
rb.MovePosistion(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
}
}