Open EngediKimHyeYoung opened 2 years ago
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayController2 : MonoBehaviour {
void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
Debug.Log("오른쪽");
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
Debug.Log("왼쪽");
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Debug.Log("위쪽");
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
Debug.Log("아래쪽");
}
if (Input.GetKeyDown(KeyCode.A))
{
Debug.Log("A");
}
if (Input.GetKeyDown(KeyCode.W))
{
Debug.Log("W");
}
if (Input.GetKeyDown(KeyCode.S))
{
Debug.Log("S");
}
if (Input.GetKeyDown(KeyCode.D))
{
Debug.Log("D");
}
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayController2 : MonoBehaviour {
void Update()
{
// Debug.Log("수평:" + Input.GetAxisRaw("Horizontal"));
Debug.Log("수직:" + Input.GetAxisRaw("Vertical"));
if (Input.GetAxisRaw("Horizontal") < 0)
{
transform.Translate(-0.02f, 0, 0);
transform.localScale = new Vector2(-1, 1);
}
if (Input.GetAxisRaw("Horizontal") > 0)
{
transform.Translate(0.02f, 0, 0);
transform.localScale = new Vector2(1, 1);
}
}
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayController2 : MonoBehaviour { public float speed = 0.005f; private Animator animator;
}