캐릭터 이동 코드 구현

This commit is contained in:
Mingu Kim
2025-06-05 03:21:27 +09:00
parent 51367624c1
commit 98597d1053
4 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using UnityEngine;
public class PlayerController : MonoBehaviour
{
private Movement2D movement2D;
private void Awake()
{
movement2D = GetComponent<Movement2D>();
}
private void Update()
{
float x = Input.GetAxis("Horizontal");
float y = Input.GetAxis("Vertical");
movement2D.MoveDirection = new Vector2(x, y);
}
}