29 lines
615 B
C#
Raw Normal View History

2025-07-16 22:36:06 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
[Header("Ԫ<><D4AA>")]
[SerializeField] private Joystick playerJoystick;
[Header("<22><><EFBFBD><EFBFBD>")]
[SerializeField] private float moveSpeed = 5;
2025-07-16 22:36:06 +08:00
private Rigidbody2D rb;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
// rb.velocity = Vector2.right;
2025-07-16 22:36:06 +08:00
}
private void FixedUpdate()
{
var v = new Vector3(playerJoystick.Horizontal, playerJoystick.Vertical,0);
transform.position += v * moveSpeed * Time.deltaTime;
2025-07-16 22:36:06 +08:00
}
}