
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
지금 1-4 강의를 수강중입니다.
르탄이가 이동하는 것, 벽에 닿으면 방향전환, 마우스 클릭시 추가적인 방향전환 까지는 잘 되는데
추가적으로 르탄이가 이동할때 방향전환을 계속 빠른속도로 하면서 파닥거리는 상태로 명령을 수행합니다.
문제점이 뭔지 알려주세요.

작성한 코드 및 에러 메세지
오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
float direction = 0.05f;
SpriteRenderer Renderer;
// Start is called before the first frame update
void Start()
{
Application.targetFrameRate = 60;
Renderer = GetComponent <SpriteRenderer>();
}
// Update is called once per frame
void Update()
{
{
if (Input.GetMouseButtonDown(0))
direction *= -1;
Renderer.flipX = !Renderer.flipX;
}
if (transform.position.x > 2.6f)
{
Renderer.flipX = true;
direction = -0.05f;
}
if (transform.position.x < -2.6f)
{
Renderer.flipX = false;
direction = 0.05f;
}
transform.position += Vector3.right * direction;
}
}
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
