Jump and run on a circle

Hello everyone, I recently approached Unity, and I would like to create a simple game to start learning the program.
I would like to try to create a copy of this game:

I created circles that rotate on themselves with this code:

    void Update () {
            transform.Rotate(0f, 0f, 100f * Time.deltaTime);
        }

But now I do not know how to proceed to make sure that an object rotates around them and can jump using the acceleration of the rotation of the circle.

Can someone help me?

Do your game in small steps :roll_eyes:
at first: add the player to the circle as child

at second: for jump you can use physics2d, add collider2d and rigidbody2d to the player. And yes, the player will fall down now from the circle. Change its rigidbody type to kinematic.

at third: do jump

Rigidbody2D rb;
    bool isJumping = false;
    public float speed;

    void Start ()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void Update ()
    {
//or use keydown
//you may need an other bool to prevent the jumping in the air
        if (Input.GetButtonDown ("Fire1"))
        {
//switch type to dynamic to allow calculate the moving
            rb.bodyType = RigidbodyType2D.Dynamic;
//unchild the player from the circle
            transform.parent = null;
            isJumping = true;
        }
    }

    void FixedUpdate ()
    {
        if (isJumping)
        {
            isJumping = false;
//you can use here addforce too
            rb.velocity = transform.up * speed;
        }
    }

at later: do something what is needed:smile: (you can use OnCollisionEnter2D to check the next circle, you can make the player child again on this circle and switch bodytype to kinematic. Then just repeat all.

and think about that in the life most things are fake (the truth is that the earth is flat, we are living in the matrix and at the end of days the dragons will come) and there is no need to calculate speed depended on the rotation. Just set it to the value that can allow to reach the next circle (and the value can be stored on the current circle).

You could use a Point Effector 2D to fake gravity. If you don’t want to use actual gravity, you could move your character using polar coordinates.

1 Like