using UnityEngine; public class FlappyBird2D : MonoBehaviour { Rigidbody2D rb; public float speed = 0.1f; public float flapHeight = 10f; void Start () { rb = GetComponent(); } void Update () { rb.velocity = new Vector2(speed, rb.velocity.y); if (Input.GetButton("Jump")) { rb.velocity = new Vector2(rb.velocity.x, flapHeight); } } }