using UnityEngine; public class PlayerMove : MonoBehaviour { public float speed; public float jumpPower; public Rigidbody2D controller; private float x; void Update() { x = Input.GetAxis("Horizontal"); if (x > 0) { transform.rotation = Quaternion.Euler(0, 0, 0); // поворот направо } if (x < 0) { transform.rotation = Quaternion.Euler(0, 180, 0); // поворот наліво } if (Input.GetButtonDown("Jump")) { controller.velocity = new Vector2(controller.velocity.x, jumpPower); } } void FixedUpdate() { controller.velocity = new Vector2(x * speed, controller.velocity.y); // рух по горизонталі } }