Open imanidukes opened 1 day ago
using UnityEngine;
public class PlayerMovement : MonoBehaviour { [SerializeField] private float speed; private Rigidbody2D body; private bool grounded;
private void Awake() { body = GetComponent<Rigidbody2D>(); } private void Update() { float horizontalInput = Input.GetAxis("Horizontal"); body.velocity = new Vector2(horizontalInput * speed, body.velocity.y); if(Input.GetKey(KeyCode.Space)) body.velocity = new Vector2(body.velocity.x, speed); } private void Jump() { body.velocity = new Vector2(body.velocity.x, speed); } private bool isGrounded() { return false; }
}
using UnityEngine;
public class PlayerMovement : MonoBehaviour { [SerializeField] private float speed; private Rigidbody2D body; private bool grounded;
}