Home > Net >  How do I make a 2D Unity Sprite Jump?
How do I make a 2D Unity Sprite Jump?

Time:09-17

Im new to game development and unity as a whole, I don't know how to add jumping to my player controls script. i copied the horizontal movement from another tutorial i found somewhere, heres the code:

    public float moveSpeed = 10f;
    public Vector2 jumpHeight;
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Initialized");
    }

    // Update is called once per frame
    void Update()
    {
        //Translate sprite based on Input.GetAxis("Horizontal") a/d input
        transform.Translate(Input.GetAxis("Horizontal") * 15f * Time.deltaTime, 0f, 0f);
    }
}

CodePudding user response:

There is alot of tutorials on youtube and Udemy showing you how to create simple platformer or other type of game, and you can find one that fits your idea of first game best. If you are at such beginning best way to learn is probably to follow step by step one of those tutorials with creator explaining what he is doing and why. There are some REaly good on udemy.

My advice for you is to do that before you try creating something 100% on your own. https://www.udemy.com/user/james-doyle-4/ this dude has very good tutorials i learned with at start.

  • Related