- Home /
Question by
melvincostner · Nov 12, 2019 at 01:25 AM ·
animation2danimatorscript.2d-platformer
2D animation diferent right and left
hello, I have an asymmetrical character and I did different left and right animations but I don't know how to implement in unity, the scripts are working just wanted to know how I can put different animations
player controller
public void Move(float direction)
{
playerAnimations.SetSpeed((int)Mathf.Abs(direction));
newMovement = new Vector2(direction * currentSpeed, rb.velocity.y);
if (facingRight && direction < 0)
{
Flip();
}
else if (!facingRight && direction > 0)
{
Flip();
}
}
player inputs
playerController.Move(Input.GetAxisRaw("Horizontal"));
player animations
public void SetSpeed(int speed)
{
anim.SetInteger("Speed", speed);
}
I hope I was clear in my doubt, forgive my bad english, I'm from Brazil.
Comment
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Animation Parameters Not Working Correctly 0 Answers
2D Animations Scaling Away From The Floor 0 Answers
Damn, HOW CAN I KNOW, IF MY 2d ANIMATION SPRITE IS FINISHED??!! 0 Answers
2D platformer - character repeats some attacks after you stop pressing attack 0 Answers