2070 / Unity / 2D / Гравець / Flappy Bird
| FlappyBird2D | MoveGenerator2D |
- Rigitbody2D: Freez Rotation z
Rigidbody2D rb; public float speed; public float flapHeight; void Start () { rb = GetComponent<Rigidbody2D>(); } void Update () { rb.velocity = new Vector2(speed, rb.velocity.y); if (Input.GetButton("Jump")) { rb.velocity = new Vector2(rb.velocity.x, flapHeight); } }