Drehen Sie die Spielereinheit 2D links und rechts
//Rotate player 2D Left and Right
static Vector3 EscalaOriginal;
static Vector3 NovaEscala;
void Start(){
EscalaOriginal = gameobject.transform.localScale;
NovaEscala = new Vector3(-0.5f, EscalaOriginal.y, EscalaOriginal.z);
}
void FixedUpdate()
{
//float horizontal = Input.GetAxis("Horizontal");
//HandleMovement (horizontal); //Movement
if (gameobject.transform.localScale != NovaEscala)
{
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
{
gameobject.transform.localScale = NovaEscala;
}
}
if (gameobject.transform.localScale != EscalaOriginal)
{
if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
{
gameobject.transform.localScale = EscalaOriginal;
}
}
}
Zarden