How to Jump on a 2D planet.
Hey I'm super new to Unity (This is my first game) and I'm making this game and so far I have a Ball(Player) that walks/moves around the planet right/left,  But I wanted to add jumping and each time he jumps he just goes up on the Y-axis, meaning that when he's at the side of the planet he just moves right (towards the top of the screen) instead of jumping up for the player(Which would now be on the X-axis I guess)
 But I wanted to add jumping and each time he jumps he just goes up on the Y-axis, meaning that when he's at the side of the planet he just moves right (towards the top of the screen) instead of jumping up for the player(Which would now be on the X-axis I guess)  For now, my code is just a lot of copy-paste from different codes I found and it's a real mess (I tried separated the jump code from the movement code by skipping a line):
 For now, my code is just a lot of copy-paste from different codes I found and it's a real mess (I tried separated the jump code from the movement code by skipping a line):
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class PlayerController : MonoBehaviour
 {
     public float moveSpeed = 15; 
     private Rigidbody2D rb2d; 
     private Vector2 moveDir;
 
     float horizontalMove = 0f;
     public CharacterController2D controller;
     bool jump = false;
 
     void Start()
     {
         rb2d = GetComponent<Rigidbody2D>();
     }
 
     void Update()
     {
         moveDir = new Vector2(Input.GetAxisRaw("Horizontal"), 0).normalized;
 
         if (Input.GetButtonDown("Jump"))
         {
             jump = true;
         }
     }
 
     void FixedUpdate()
     {
         Vector2 globalmovedir = (transform.TransformDirection(moveDir));
         rb2d.position += globalmovedir * moveSpeed * Time.fixedDeltaTime;
 
         controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
         jump = false;
     }
 }
So I now I need to completely change my jump code, but I'm not too sure how to fix it, could anyone please tell me what my jump code should be (I tried searching but no luck)?
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                