PlayerController.cs 474 B

123456789101112131415161718192021
  1. using Cinemachine;
  2. using DG.Tweening;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. public class PlayerController : MonoBehaviour {
  7. public float movementSpeed = 5f;
  8. private Rigidbody2D rb;
  9. void Start() {
  10. rb = GetComponent<Rigidbody2D>();
  11. }
  12. void FixedUpdate() {
  13. // ÒÆ¶¯
  14. rb.velocity = new Vector2(Input.GetAxis("Horizontal") * movementSpeed, Input.GetAxis("Vertical") * movementSpeed);
  15. }
  16. }