Search Unity

Top Down 2D Animation - Can't seem to get it right

Discussion in 'Animation' started by xdommmy, Aug 4, 2019.

  1. xdommmy

    xdommmy

    Joined:
    Oct 26, 2018
    Posts:
    1
    I'm making a 2D top-down game, there are 4 animations

    Front Idle
    Back Idle

    Front Walking
    Back Walking

    I cannot seem to wrap my head around how to create parameters to run the animations at the proper moments. When I am walking upwards, I want the player to 'Back Walking'. When I stop, the player should 'Back Idle', and the same logic applies to the front walking and front idle.

    Could someone help me figure out what parameters I should use and how I should impliment them into my walking script.

    Code (CSharp):
    1. Vector2 moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    2.         moveVelocity = moveInput.normalized * speed;
    3. rb.velocity = moveVelocity;
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    My Animancer plugin (link in my signature) has some Directional Sprites examples which demonstrate how to implement this sort of thing without needing to create an Animator Controller or mess around with parameters.