Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlayerMovement : MonoBehaviour
- {
- // Start is called before the first frame update
- public float speed;
- public float jump;
- private float move;
- private Rigidbody2D rb;
- void Start()
- {
- rb = GetComponent<Rigidbody2D>();
- }
- // Update is called once per frame
- void Update()
- {
- move = Input.getAxisRaw("Horizontal");
- rb.velocity = new Vector2(move * speed, rb.velocity.y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement