Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
987 B
6
Indexable
Never
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bird : MonoBehaviour
{
    public float SpeedUp = 0.1f;
    public float SpeedDown = 0.1f;
    public float SpeedLeft = 0.1f;
    public float SpeedRight = 0.1f;

    // Start is called before the first frame update
    void Start()
    {

        Debug.Log("Start");
    }

    // Update is called once per frame
    void Update()
    {
        //  Debug.Log("Update");

        if (Input.GetKey(KeyCode.RightArrow))
        {
            transform.position += new Vector3(SpeedRight, 0, 0);
        }
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            transform.position -= new Vector3(SpeedLeft, 0, 0);
        }
        if (Input.GetKey(KeyCode.UpArrow))
        {
            transform.position += new Vector3(0, SpeedUp, 0);
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            transform.position -= new Vector3(0, SpeedDown, 0);
        }
    }
}