code to move and jump.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move : MonoBehaviour
{
public float movespeed;
public float jumppower;
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.RightArrow))
transform.Translate(Vector3.right * movespeed * Time.deltaTime);
if (Input.GetKey(KeyCode.LeftArrow))
transform.Translate(-Vector2.right * movespeed * Time.deltaTime);
Rigidbody2D rb = GetComponentRigidbody2D();
if (Input.GetKey(KeyCode.Space))
rb.AddForce(Vector2.up * jumppower);
}
}