G
G
Gleb_Shalygin2021-07-30 09:31:54
VMware
Gleb_Shalygin, 2021-07-30 09:31:54

Jumping and moving forward a Unity2d character?

Good day! I would like to ask how to implement so that the character can jump and move forward at the same time when pressing one space ? And the second point, how to make the jump force when holding the space bar?
The game will be something like a jumper game in VK only 2d.

Vector2 jump = (transform.up * jumpForce) + (transform.right * 50);

        if (Input.GetKeyUp(KeyCode.Space))
        {
            rb.AddForce(jump, ForceMode2D.Impulse);
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
ReyGrau, 2021-07-30
@ReyGrau

Use the character's velocity .

C
Crebor, 2021-07-31
@Crebor

https://www.youtube.com/watch?v=Ux6wQQIHimQ

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question