Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Player : MonoBehaviour {
- float xMove = 0;
- float yMove = 0;
- float gravity = 0.1f;
- void FixedUpdate() {
- yMove += gravity;
- }
- void Update() {
- xMove = Input.GetAxis("Horizontal");
- if (onGround && Input.GetKeyDown(KeyCode.Space)) {
- yMove = -5;
- }
- transform.Translate(new Vector3(xMove,yMove,0)* Time.deltaTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment